From 60429f574a9b307718f24dc14b129823115cfa30 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 18:41:12 +0000 Subject: [PATCH 1/5] Regenerate client from commit 6eeeeb0 of spec repo (#4245) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 449 -------------- api/datadog/configuration.go | 5 - api/datadogV2/api_incident_services.go | 551 ------------------ api/datadogV2/doc.go | 5 - ...odel_incident_service_create_attributes.go | 101 ---- .../model_incident_service_create_data.go | 189 ------ .../model_incident_service_create_request.go | 110 ---- .../model_incident_service_included_items.go | 73 --- .../model_incident_service_relationships.go | 149 ----- .../model_incident_service_response.go | 145 ----- ...el_incident_service_response_attributes.go | 182 ------ .../model_incident_service_response_data.go | 221 ------- api/datadogV2/model_incident_service_type.go | 64 -- ...odel_incident_service_update_attributes.go | 101 ---- .../model_incident_service_update_data.go | 224 ------- .../model_incident_service_update_request.go | 110 ---- .../model_incident_services_response.go | 180 ------ .../CreateIncidentService.go | 38 -- .../DeleteIncidentService.go | 29 - .../incident-services/GetIncidentService.go | 33 -- .../incident-services/ListIncidentServices.go | 33 -- .../UpdateIncidentService.go | 41 -- tests/scenarios/api_mappings.go | 1 - ...nt_service_returns_CREATED_response.freeze | 1 - ...dent_service_returns_CREATED_response.yaml | 37 -- ...ncident_service_returns_OK_response.freeze | 1 - ..._incident_service_returns_OK_response.yaml | 52 -- ...cident_services_returns_OK_response.freeze | 1 - ...incident_services_returns_OK_response.yaml | 54 -- ...ncident_service_returns_OK_response.freeze | 1 - ..._incident_service_returns_OK_response.yaml | 54 -- ...ncident_service_returns_OK_response.freeze | 1 - ..._incident_service_returns_OK_response.yaml | 57 -- tests/scenarios/features/v2/given.json | 12 - .../features/v2/incident_services.feature | 146 ----- tests/scenarios/features/v2/undo.json | 37 -- 36 files changed, 3488 deletions(-) delete mode 100644 api/datadogV2/api_incident_services.go delete mode 100644 api/datadogV2/model_incident_service_create_attributes.go delete mode 100644 api/datadogV2/model_incident_service_create_data.go delete mode 100644 api/datadogV2/model_incident_service_create_request.go delete mode 100644 api/datadogV2/model_incident_service_included_items.go delete mode 100644 api/datadogV2/model_incident_service_relationships.go delete mode 100644 api/datadogV2/model_incident_service_response.go delete mode 100644 api/datadogV2/model_incident_service_response_attributes.go delete mode 100644 api/datadogV2/model_incident_service_response_data.go delete mode 100644 api/datadogV2/model_incident_service_type.go delete mode 100644 api/datadogV2/model_incident_service_update_attributes.go delete mode 100644 api/datadogV2/model_incident_service_update_data.go delete mode 100644 api/datadogV2/model_incident_service_update_request.go delete mode 100644 api/datadogV2/model_incident_services_response.go delete mode 100644 examples/v2/incident-services/CreateIncidentService.go delete mode 100644 examples/v2/incident-services/DeleteIncidentService.go delete mode 100644 examples/v2/incident-services/GetIncidentService.go delete mode 100644 examples/v2/incident-services/ListIncidentServices.go delete mode 100644 examples/v2/incident-services/UpdateIncidentService.go delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.freeze delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.yaml delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.freeze delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.yaml delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.freeze delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.yaml delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.freeze delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.yaml delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.freeze delete mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.yaml delete mode 100644 tests/scenarios/features/v2/incident_services.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ce0ea5b8443..3b3cdf42c0c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -814,28 +814,6 @@ components: required: false schema: $ref: "#/components/schemas/IncidentSearchSortOrder" - IncidentServiceIDPathParameter: - description: The ID of the incident service. - in: path - name: service_id - required: true - schema: - type: string - IncidentServiceIncludeQueryParameter: - description: Specifies which types of related objects should be included in the response. - in: query - name: "include" - required: false - schema: - $ref: "#/components/schemas/IncidentRelatedObject" - IncidentServiceSearchQueryParameter: - description: A search query that filters services by name. - in: query - name: "filter" - required: false - schema: - example: "ExampleServiceName" - type: string IncidentTodoIDPathParameter: description: The UUID of the incident todo. in: path @@ -43499,161 +43477,6 @@ components: x-enum-varnames: - CREATED_ASCENDING - CREATED_DESCENDING - IncidentServiceCreateAttributes: - description: The incident service's attributes for a create request. - properties: - name: - description: Name of the incident service. - example: "an example service name" - type: string - required: - - name - type: object - IncidentServiceCreateData: - description: Incident Service payload for create requests. - properties: - attributes: - $ref: "#/components/schemas/IncidentServiceCreateAttributes" - relationships: - $ref: "#/components/schemas/IncidentServiceRelationships" - type: - $ref: "#/components/schemas/IncidentServiceType" - required: - - type - type: object - IncidentServiceCreateRequest: - description: Create request with an incident service payload. - properties: - data: - $ref: "#/components/schemas/IncidentServiceCreateData" - required: - - data - type: object - IncidentServiceIncludedItems: - description: An object related to an incident service which is present in the included payload. - oneOf: - - $ref: "#/components/schemas/User" - IncidentServiceRelationships: - description: The incident service's relationships. - properties: - created_by: - $ref: "#/components/schemas/RelationshipToUser" - last_modified_by: - $ref: "#/components/schemas/RelationshipToUser" - readOnly: true - type: object - IncidentServiceResponse: - description: Response with an incident service payload. - properties: - data: - $ref: "#/components/schemas/IncidentServiceResponseData" - included: - description: Included objects from relationships. - items: - $ref: "#/components/schemas/IncidentServiceIncludedItems" - readOnly: true - type: array - required: - - data - type: object - IncidentServiceResponseAttributes: - description: The incident service's attributes from a response. - properties: - created: - description: Timestamp of when the incident service was created. - format: date-time - readOnly: true - type: string - modified: - description: Timestamp of when the incident service was modified. - format: date-time - readOnly: true - type: string - name: - description: Name of the incident service. - example: "service name" - type: string - type: object - IncidentServiceResponseData: - description: Incident Service data from responses. - properties: - attributes: - $ref: "#/components/schemas/IncidentServiceResponseAttributes" - id: - description: The incident service's ID. - example: "00000000-0000-0000-0000-000000000000" - type: string - relationships: - $ref: "#/components/schemas/IncidentServiceRelationships" - type: - $ref: "#/components/schemas/IncidentServiceType" - required: - - id - - type - type: object - IncidentServiceType: - default: services - description: Incident service resource type. - enum: - - services - example: services - type: string - x-enum-varnames: - - SERVICES - IncidentServiceUpdateAttributes: - description: The incident service's attributes for an update request. - properties: - name: - description: Name of the incident service. - example: "an example service name" - type: string - required: - - name - type: object - IncidentServiceUpdateData: - description: Incident Service payload for update requests. - properties: - attributes: - $ref: "#/components/schemas/IncidentServiceUpdateAttributes" - id: - description: The incident service's ID. - example: "00000000-0000-0000-0000-000000000000" - type: string - relationships: - $ref: "#/components/schemas/IncidentServiceRelationships" - type: - $ref: "#/components/schemas/IncidentServiceType" - required: - - type - type: object - IncidentServiceUpdateRequest: - description: Update request with an incident service payload. - properties: - data: - $ref: "#/components/schemas/IncidentServiceUpdateData" - required: - - data - type: object - IncidentServicesResponse: - description: Response with a list of incident service payloads. - properties: - data: - description: An array of incident services. - example: [{"id": "00000000-0000-0000-0000-000000000000", "type": "services"}] - items: - $ref: "#/components/schemas/IncidentServiceResponseData" - type: array - included: - description: Included related resources which the user requested. - items: - $ref: "#/components/schemas/IncidentServiceIncludedItems" - readOnly: true - type: array - meta: - $ref: "#/components/schemas/IncidentResponseMeta" - required: - - data - type: "object" IncidentSeverity: description: The incident severity. enum: @@ -172241,123 +172064,6 @@ paths: operator: OR permissions: - service_account_write - /api/v2/services: - get: - deprecated: true - description: >- - Get all incident services uploaded for the requesting user's organization. If the `include[users]` query parameter is provided, the included attribute will contain the users related to these incident services. - operationId: ListIncidentServices - parameters: - - $ref: "#/components/parameters/IncidentServiceIncludeQueryParameter" - - $ref: "#/components/parameters/PageSize" - - $ref: "#/components/parameters/PageOffset" - - $ref: "#/components/parameters/IncidentServiceSearchQueryParameter" - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - - attributes: - name: test-service - id: 00000000-0000-0000-0000-000000000002 - type: services - schema: - $ref: "#/components/schemas/IncidentServicesResponse" - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "401": - $ref: "#/components/responses/UnauthorizedResponse" - "403": - $ref: "#/components/responses/ForbiddenResponse" - "404": - $ref: "#/components/responses/NotFoundResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - incident_read - summary: Get a list of all incident services - tags: - - Incident Services - "x-permission": - operator: OR - permissions: - - incident_read - x-unstable: |- - **Note**: This endpoint is deprecated. - post: - deprecated: true - description: Creates a new incident service. - operationId: CreateIncidentService - requestBody: - content: - application/json: - examples: - default: - value: - data: - attributes: - name: an example service name - relationships: - created_by: - data: - id: 00000000-0000-0000-2345-000000000000 - type: users - last_modified_by: - data: - id: 00000000-0000-0000-2345-000000000000 - type: users - type: services - schema: - $ref: "#/components/schemas/IncidentServiceCreateRequest" - description: Incident Service Payload. - required: true - responses: - "201": - content: - application/json: - examples: - default: - value: - data: - attributes: - name: test-service - id: 00000000-0000-0000-0000-000000000001 - type: services - schema: - $ref: "#/components/schemas/IncidentServiceResponse" - description: CREATED - "400": - $ref: "#/components/responses/BadRequestResponse" - "401": - $ref: "#/components/responses/UnauthorizedResponse" - "403": - $ref: "#/components/responses/ForbiddenResponse" - "404": - $ref: "#/components/responses/NotFoundResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - incident_settings_write - summary: Create a new incident service - tags: - - Incident Services - x-codegen-request-body-name: body - "x-permission": - operator: OR - permissions: - - incident_settings_write - x-unstable: |- - **Note**: This endpoint is deprecated. /api/v2/services/definitions: get: description: Get a list of all service definitions from the Datadog Service Catalog. @@ -172570,159 +172276,6 @@ paths: operator: OR permissions: - apm_service_catalog_read - /api/v2/services/{service_id}: - delete: - deprecated: true - description: Deletes an existing incident service. - operationId: DeleteIncidentService - parameters: - - $ref: "#/components/parameters/IncidentServiceIDPathParameter" - responses: - "204": - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "401": - $ref: "#/components/responses/UnauthorizedResponse" - "403": - $ref: "#/components/responses/ForbiddenResponse" - "404": - $ref: "#/components/responses/NotFoundResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - incident_settings_write - summary: Delete an existing incident service - tags: - - Incident Services - "x-permission": - operator: OR - permissions: - - incident_settings_write - x-unstable: |- - **Note**: This endpoint is deprecated. - get: - deprecated: true - description: |- - Get details of an incident service. If the `include[users]` query parameter is provided, - the included attribute will contain the users related to these incident services. - operationId: GetIncidentService - parameters: - - $ref: "#/components/parameters/IncidentServiceIDPathParameter" - - $ref: "#/components/parameters/IncidentServiceIncludeQueryParameter" - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - attributes: - name: test-service - id: 00000000-0000-0000-0000-000000000004 - type: services - schema: - $ref: "#/components/schemas/IncidentServiceResponse" - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "401": - $ref: "#/components/responses/UnauthorizedResponse" - "403": - $ref: "#/components/responses/ForbiddenResponse" - "404": - $ref: "#/components/responses/NotFoundResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - incident_read - summary: Get details of an incident service - tags: - - Incident Services - "x-permission": - operator: OR - permissions: - - incident_read - x-unstable: |- - **Note**: This endpoint is deprecated. - patch: - deprecated: true - description: >- - Updates an existing incident service. Only provide the attributes which should be updated as this request is a partial update. - operationId: UpdateIncidentService - parameters: - - $ref: "#/components/parameters/IncidentServiceIDPathParameter" - requestBody: - content: - application/json: - examples: - default: - value: - data: - attributes: - name: an example service name - id: 00000000-0000-0000-0000-000000000000 - relationships: - created_by: - data: - id: 00000000-0000-0000-2345-000000000000 - type: users - last_modified_by: - data: - id: 00000000-0000-0000-2345-000000000000 - type: users - type: services - schema: - $ref: "#/components/schemas/IncidentServiceUpdateRequest" - description: Incident Service Payload. - required: true - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - attributes: - name: test-service - id: 00000000-0000-0000-0000-000000000003 - type: services - schema: - $ref: "#/components/schemas/IncidentServiceResponse" - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "401": - $ref: "#/components/responses/UnauthorizedResponse" - "403": - $ref: "#/components/responses/ForbiddenResponse" - "404": - $ref: "#/components/responses/NotFoundResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - incident_settings_write - summary: Update an existing incident service - tags: - - Incident Services - x-codegen-request-body-name: body - "x-permission": - operator: OR - permissions: - - incident_settings_write - x-unstable: |- - **Note**: This endpoint is deprecated. /api/v2/siem-historical-detections/histsignals: get: description: List hist signals. @@ -186682,8 +186235,6 @@ tags: This is an enterprise-only feature. Request access by contacting Datadog support, or see the [IP Allowlist page](https://docs.datadoghq.com/account_management/org_settings/ip_allowlist/) for more information. name: IP Allowlist - - description: Create, update, delete, and retrieve services which can be associated with incidents. See the [Incident Management page](https://docs.datadoghq.com/service_management/incident_management/) for more information. - name: Incident Services - description: Manage incident response, as well as associated attachments, metadata, and todos. See the [Incident Management page](https://docs.datadoghq.com/service_management/incident_management/) for more information. name: Incidents - description: |- diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index b4243d3d375..a1bdac7d166 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -1082,11 +1082,6 @@ func NewConfiguration() *Configuration { "v2.CreateScorecardOutcomesBatch": false, "v2.GetEntityRiskScore": false, "v2.ListEntityRiskScores": false, - "v2.CreateIncidentService": false, - "v2.DeleteIncidentService": false, - "v2.GetIncidentService": false, - "v2.ListIncidentServices": false, - "v2.UpdateIncidentService": false, "v2.CreateSLOReportJob": false, "v2.GetSLOReport": false, "v2.GetSLOReportJobStatus": false, diff --git a/api/datadogV2/api_incident_services.go b/api/datadogV2/api_incident_services.go deleted file mode 100644 index b14488337f7..00000000000 --- a/api/datadogV2/api_incident_services.go +++ /dev/null @@ -1,551 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - _context "context" - _fmt "fmt" - _log "log" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// IncidentServicesApi service type -type IncidentServicesApi datadog.Service - -// CreateIncidentService Create a new incident service. -// Creates a new incident service. -// -// Deprecated: This API is deprecated. -func (a *IncidentServicesApi) CreateIncidentService(ctx _context.Context, body IncidentServiceCreateRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IncidentServiceResponse - ) - - operationId := "v2.CreateIncidentService" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentServicesApi.CreateIncidentService") - if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = &body - if a.Client.Cfg.DelegatedTokenConfig != nil { - err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) - if err != nil { - return localVarReturnValue, nil, err - } - } else { - datadog.SetAuthKeys( - ctx, - &localVarHeaderParams, - [2]string{"apiKeyAuth", "DD-API-KEY"}, - [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - ) - } - req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// DeleteIncidentService Delete an existing incident service. -// Deletes an existing incident service. -// -// Deprecated: This API is deprecated. -func (a *IncidentServicesApi) DeleteIncidentService(ctx _context.Context, serviceId string) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - operationId := "v2.DeleteIncidentService" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentServicesApi.DeleteIncidentService") - if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services/{service_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{service_id}", _neturl.PathEscape(datadog.ParameterToString(serviceId, ""))) - - 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -// GetIncidentServiceOptionalParameters holds optional parameters for GetIncidentService. -type GetIncidentServiceOptionalParameters struct { - Include *IncidentRelatedObject -} - -// NewGetIncidentServiceOptionalParameters creates an empty struct for parameters. -func NewGetIncidentServiceOptionalParameters() *GetIncidentServiceOptionalParameters { - this := GetIncidentServiceOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentServiceOptionalParameters) WithInclude(include IncidentRelatedObject) *GetIncidentServiceOptionalParameters { - r.Include = &include - return r -} - -// GetIncidentService Get details of an incident service. -// Get details of an incident service. If the `include[users]` query parameter is provided, -// the included attribute will contain the users related to these incident services. -// -// Deprecated: This API is deprecated. -func (a *IncidentServicesApi) GetIncidentService(ctx _context.Context, serviceId string, o ...GetIncidentServiceOptionalParameters) (IncidentServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentServiceResponse - optionalParams GetIncidentServiceOptionalParameters - ) - - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentServiceOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.GetIncidentService" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentServicesApi.GetIncidentService") - if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services/{service_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{service_id}", _neturl.PathEscape(datadog.ParameterToString(serviceId, ""))) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if a.Client.Cfg.DelegatedTokenConfig != nil { - err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) - if err != nil { - return localVarReturnValue, nil, err - } - } else { - datadog.SetAuthKeys( - ctx, - &localVarHeaderParams, - [2]string{"apiKeyAuth", "DD-API-KEY"}, - [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - ) - } - req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// ListIncidentServicesOptionalParameters holds optional parameters for ListIncidentServices. -type ListIncidentServicesOptionalParameters struct { - Include *IncidentRelatedObject - PageSize *int64 - PageOffset *int64 - Filter *string -} - -// NewListIncidentServicesOptionalParameters creates an empty struct for parameters. -func NewListIncidentServicesOptionalParameters() *ListIncidentServicesOptionalParameters { - this := ListIncidentServicesOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithInclude(include IncidentRelatedObject) *ListIncidentServicesOptionalParameters { - r.Include = &include - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithPageSize(pageSize int64) *ListIncidentServicesOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageOffset sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentServicesOptionalParameters { - r.PageOffset = &pageOffset - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithFilter(filter string) *ListIncidentServicesOptionalParameters { - r.Filter = &filter - return r -} - -// ListIncidentServices Get a list of all incident services. -// Get all incident services uploaded for the requesting user's organization. If the `include[users]` query parameter is provided, the included attribute will contain the users related to these incident services. -// -// Deprecated: This API is deprecated. -func (a *IncidentServicesApi) ListIncidentServices(ctx _context.Context, o ...ListIncidentServicesOptionalParameters) (IncidentServicesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentServicesResponse - optionalParams ListIncidentServicesOptionalParameters - ) - - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentServicesOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.ListIncidentServices" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentServicesApi.ListIncidentServices") - if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } - if optionalParams.PageSize != nil { - localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) - } - if optionalParams.PageOffset != nil { - localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) - } - if optionalParams.Filter != nil { - localVarQueryParams.Add("filter", datadog.ParameterToString(*optionalParams.Filter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if a.Client.Cfg.DelegatedTokenConfig != nil { - err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) - if err != nil { - return localVarReturnValue, nil, err - } - } else { - datadog.SetAuthKeys( - ctx, - &localVarHeaderParams, - [2]string{"apiKeyAuth", "DD-API-KEY"}, - [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - ) - } - req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// UpdateIncidentService Update an existing incident service. -// Updates an existing incident service. Only provide the attributes which should be updated as this request is a partial update. -// -// Deprecated: This API is deprecated. -func (a *IncidentServicesApi) UpdateIncidentService(ctx _context.Context, serviceId string, body IncidentServiceUpdateRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue IncidentServiceResponse - ) - - operationId := "v2.UpdateIncidentService" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentServicesApi.UpdateIncidentService") - if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services/{service_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{service_id}", _neturl.PathEscape(datadog.ParameterToString(serviceId, ""))) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = &body - if a.Client.Cfg.DelegatedTokenConfig != nil { - err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) - if err != nil { - return localVarReturnValue, nil, err - } - } else { - datadog.SetAuthKeys( - ctx, - &localVarHeaderParams, - [2]string{"apiKeyAuth", "DD-API-KEY"}, - [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - ) - } - req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewIncidentServicesApi Returns NewIncidentServicesApi. -func NewIncidentServicesApi(client *datadog.APIClient) *IncidentServicesApi { - return &IncidentServicesApi{ - Client: client, - } -} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index c74004601b9..072b51c13cc 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -482,11 +482,6 @@ // - [HighAvailabilityMultiRegionApi.GetHamrOrgConnection] // - [IPAllowlistApi.GetIPAllowlist] // - [IPAllowlistApi.UpdateIPAllowlist] -// - [IncidentServicesApi.CreateIncidentService] -// - [IncidentServicesApi.DeleteIncidentService] -// - [IncidentServicesApi.GetIncidentService] -// - [IncidentServicesApi.ListIncidentServices] -// - [IncidentServicesApi.UpdateIncidentService] // - [IncidentsApi.CreateGlobalIncidentHandle] // - [IncidentsApi.CreateIncident] // - [IncidentsApi.CreateIncidentAttachment] diff --git a/api/datadogV2/model_incident_service_create_attributes.go b/api/datadogV2/model_incident_service_create_attributes.go deleted file mode 100644 index b4d8b9996ef..00000000000 --- a/api/datadogV2/model_incident_service_create_attributes.go +++ /dev/null @@ -1,101 +0,0 @@ -// 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" -) - -// IncidentServiceCreateAttributes The incident service's attributes for a create request. -type IncidentServiceCreateAttributes struct { - // Name of the incident service. - Name string `json:"name"` - // 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:"-"` -} - -// NewIncidentServiceCreateAttributes instantiates a new IncidentServiceCreateAttributes 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 NewIncidentServiceCreateAttributes(name string) *IncidentServiceCreateAttributes { - this := IncidentServiceCreateAttributes{} - this.Name = name - return &this -} - -// NewIncidentServiceCreateAttributesWithDefaults instantiates a new IncidentServiceCreateAttributes 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 NewIncidentServiceCreateAttributesWithDefaults() *IncidentServiceCreateAttributes { - this := IncidentServiceCreateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *IncidentServiceCreateAttributes) 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 *IncidentServiceCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *IncidentServiceCreateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Name *string `json:"name"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Name == nil { - return fmt.Errorf("required field name missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"name"}) - } else { - return err - } - o.Name = *all.Name - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_create_data.go b/api/datadogV2/model_incident_service_create_data.go deleted file mode 100644 index 33ab905e4fc..00000000000 --- a/api/datadogV2/model_incident_service_create_data.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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" -) - -// IncidentServiceCreateData Incident Service payload for create requests. -type IncidentServiceCreateData struct { - // The incident service's attributes for a create request. - Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` - // The incident service's relationships. - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - // Incident service resource type. - Type IncidentServiceType `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:"-"` -} - -// NewIncidentServiceCreateData instantiates a new IncidentServiceCreateData 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 NewIncidentServiceCreateData(typeVar IncidentServiceType) *IncidentServiceCreateData { - this := IncidentServiceCreateData{} - this.Type = typeVar - return &this -} - -// NewIncidentServiceCreateDataWithDefaults instantiates a new IncidentServiceCreateData 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 NewIncidentServiceCreateDataWithDefaults() *IncidentServiceCreateData { - this := IncidentServiceCreateData{} - var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentServiceCreateData) GetAttributes() IncidentServiceCreateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentServiceCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceCreateData) GetAttributesOk() (*IncidentServiceCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentServiceCreateData) HasAttributes() bool { - return o != nil && o.Attributes != nil -} - -// SetAttributes gets a reference to the given IncidentServiceCreateAttributes and assigns it to the Attributes field. -func (o *IncidentServiceCreateData) SetAttributes(v IncidentServiceCreateAttributes) { - o.Attributes = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentServiceCreateData) GetRelationships() IncidentServiceRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentServiceRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceCreateData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentServiceCreateData) HasRelationships() bool { - return o != nil && o.Relationships != nil -} - -// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. -func (o *IncidentServiceCreateData) SetRelationships(v IncidentServiceRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentServiceCreateData) GetType() IncidentServiceType { - if o == nil { - var ret IncidentServiceType - 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 *IncidentServiceCreateData) GetTypeOk() (*IncidentServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentServiceCreateData) SetType(v IncidentServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type *IncidentServiceType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) - } else { - return err - } - - hasInvalidField := false - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Relationships = all.Relationships - if !all.Type.IsValid() { - hasInvalidField = true - } else { - o.Type = *all.Type - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_create_request.go b/api/datadogV2/model_incident_service_create_request.go deleted file mode 100644 index 9351260ef75..00000000000 --- a/api/datadogV2/model_incident_service_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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" -) - -// IncidentServiceCreateRequest Create request with an incident service payload. -type IncidentServiceCreateRequest struct { - // Incident Service payload for create requests. - Data IncidentServiceCreateData `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:"-"` -} - -// NewIncidentServiceCreateRequest instantiates a new IncidentServiceCreateRequest 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 NewIncidentServiceCreateRequest(data IncidentServiceCreateData) *IncidentServiceCreateRequest { - this := IncidentServiceCreateRequest{} - this.Data = data - return &this -} - -// NewIncidentServiceCreateRequestWithDefaults instantiates a new IncidentServiceCreateRequest 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 NewIncidentServiceCreateRequestWithDefaults() *IncidentServiceCreateRequest { - this := IncidentServiceCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServiceCreateRequest) GetData() IncidentServiceCreateData { - if o == nil { - var ret IncidentServiceCreateData - 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 *IncidentServiceCreateRequest) GetDataOk() (*IncidentServiceCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServiceCreateRequest) SetData(v IncidentServiceCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceCreateRequest) 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 *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Data *IncidentServiceCreateData `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_incident_service_included_items.go b/api/datadogV2/model_incident_service_included_items.go deleted file mode 100644 index 7812992ea50..00000000000 --- a/api/datadogV2/model_incident_service_included_items.go +++ /dev/null @@ -1,73 +0,0 @@ -// 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" -) - -// IncidentServiceIncludedItems - An object related to an incident service which is present in the included payload. -type IncidentServiceIncludedItems struct { - User *User - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// UserAsIncidentServiceIncludedItems is a convenience function that returns User wrapped in IncidentServiceIncludedItems. -func UserAsIncidentServiceIncludedItems(v *User) IncidentServiceIncludedItems { - return IncidentServiceIncludedItems{User: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *IncidentServiceIncludedItems) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into User - err = datadog.Unmarshal(data, &obj.User) - if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := datadog.Marshal(obj.User) - if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct - obj.User = nil - } else { - match++ - } - } else { - obj.User = nil - } - } else { - obj.User = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.User = nil - return datadog.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj IncidentServiceIncludedItems) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return datadog.Marshal(&obj.User) - } - - if obj.UnparsedObject != nil { - return datadog.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *IncidentServiceIncludedItems) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User - } - - // all schemas are nil - return nil -} diff --git a/api/datadogV2/model_incident_service_relationships.go b/api/datadogV2/model_incident_service_relationships.go deleted file mode 100644 index 1db5686072d..00000000000 --- a/api/datadogV2/model_incident_service_relationships.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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" -) - -// IncidentServiceRelationships The incident service's relationships. -type IncidentServiceRelationships struct { - // Relationship to user. - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - // Relationship to user. - LastModifiedBy *RelationshipToUser `json:"last_modified_by,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:"-"` -} - -// NewIncidentServiceRelationships instantiates a new IncidentServiceRelationships 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 NewIncidentServiceRelationships() *IncidentServiceRelationships { - this := IncidentServiceRelationships{} - return &this -} - -// NewIncidentServiceRelationshipsWithDefaults instantiates a new IncidentServiceRelationships 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 NewIncidentServiceRelationshipsWithDefaults() *IncidentServiceRelationships { - this := IncidentServiceRelationships{} - return &this -} - -// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. -func (o *IncidentServiceRelationships) GetCreatedBy() RelationshipToUser { - if o == nil || o.CreatedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.CreatedBy -} - -// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { - if o == nil || o.CreatedBy == nil { - return nil, false - } - return o.CreatedBy, true -} - -// HasCreatedBy returns a boolean if a field has been set. -func (o *IncidentServiceRelationships) HasCreatedBy() bool { - return o != nil && o.CreatedBy != nil -} - -// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. -func (o *IncidentServiceRelationships) SetCreatedBy(v RelationshipToUser) { - o.CreatedBy = &v -} - -// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. -func (o *IncidentServiceRelationships) GetLastModifiedBy() RelationshipToUser { - if o == nil || o.LastModifiedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.LastModifiedBy -} - -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceRelationships) GetLastModifiedByOk() (*RelationshipToUser, bool) { - if o == nil || o.LastModifiedBy == nil { - return nil, false - } - return o.LastModifiedBy, true -} - -// HasLastModifiedBy returns a boolean if a field has been set. -func (o *IncidentServiceRelationships) HasLastModifiedBy() bool { - return o != nil && o.LastModifiedBy != nil -} - -// SetLastModifiedBy gets a reference to the given RelationshipToUser and assigns it to the LastModifiedBy field. -func (o *IncidentServiceRelationships) SetLastModifiedBy(v RelationshipToUser) { - o.LastModifiedBy = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.CreatedBy != nil { - toSerialize["created_by"] = o.CreatedBy - } - if o.LastModifiedBy != nil { - toSerialize["last_modified_by"] = o.LastModifiedBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceRelationships) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - LastModifiedBy *RelationshipToUser `json:"last_modified_by,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{"created_by", "last_modified_by"}) - } else { - return err - } - - hasInvalidField := false - if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.CreatedBy = all.CreatedBy - if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.LastModifiedBy = all.LastModifiedBy - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_response.go b/api/datadogV2/model_incident_service_response.go deleted file mode 100644 index b9a90238417..00000000000 --- a/api/datadogV2/model_incident_service_response.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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" -) - -// IncidentServiceResponse Response with an incident service payload. -type IncidentServiceResponse struct { - // Incident Service data from responses. - Data IncidentServiceResponseData `json:"data"` - // Included objects from relationships. - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewIncidentServiceResponse instantiates a new IncidentServiceResponse 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 NewIncidentServiceResponse(data IncidentServiceResponseData) *IncidentServiceResponse { - this := IncidentServiceResponse{} - this.Data = data - return &this -} - -// NewIncidentServiceResponseWithDefaults instantiates a new IncidentServiceResponse 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 NewIncidentServiceResponseWithDefaults() *IncidentServiceResponse { - this := IncidentServiceResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServiceResponse) GetData() IncidentServiceResponseData { - if o == nil { - var ret IncidentServiceResponseData - 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 *IncidentServiceResponse) GetDataOk() (*IncidentServiceResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServiceResponse) SetData(v IncidentServiceResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentServiceResponse) GetIncluded() []IncidentServiceIncludedItems { - if o == nil || o.Included == nil { - var ret []IncidentServiceIncludedItems - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponse) GetIncludedOk() (*[]IncidentServiceIncludedItems, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentServiceResponse) HasIncluded() bool { - return o != nil && o.Included != nil -} - -// SetIncluded gets a reference to the given []IncidentServiceIncludedItems and assigns it to the Included field. -func (o *IncidentServiceResponse) SetIncluded(v []IncidentServiceIncludedItems) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Data *IncidentServiceResponseData `json:"data"` - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Data == nil { - return fmt.Errorf("required field data missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) - } else { - return err - } - - hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Data = *all.Data - o.Included = all.Included - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_response_attributes.go b/api/datadogV2/model_incident_service_response_attributes.go deleted file mode 100644 index 431156531c0..00000000000 --- a/api/datadogV2/model_incident_service_response_attributes.go +++ /dev/null @@ -1,182 +0,0 @@ -// 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 ( - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// IncidentServiceResponseAttributes The incident service's attributes from a response. -type IncidentServiceResponseAttributes struct { - // Timestamp of when the incident service was created. - Created *time.Time `json:"created,omitempty"` - // Timestamp of when the incident service was modified. - Modified *time.Time `json:"modified,omitempty"` - // Name of the incident service. - Name *string `json:"name,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewIncidentServiceResponseAttributes instantiates a new IncidentServiceResponseAttributes 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 NewIncidentServiceResponseAttributes() *IncidentServiceResponseAttributes { - this := IncidentServiceResponseAttributes{} - return &this -} - -// NewIncidentServiceResponseAttributesWithDefaults instantiates a new IncidentServiceResponseAttributes 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 NewIncidentServiceResponseAttributesWithDefaults() *IncidentServiceResponseAttributes { - this := IncidentServiceResponseAttributes{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *IncidentServiceResponseAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *IncidentServiceResponseAttributes) HasCreated() bool { - return o != nil && o.Created != nil -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *IncidentServiceResponseAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *IncidentServiceResponseAttributes) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseAttributes) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *IncidentServiceResponseAttributes) HasModified() bool { - return o != nil && o.Modified != nil -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *IncidentServiceResponseAttributes) SetModified(v time.Time) { - o.Modified = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *IncidentServiceResponseAttributes) 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 *IncidentServiceResponseAttributes) 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 *IncidentServiceResponseAttributes) 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 *IncidentServiceResponseAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Created *time.Time `json:"created,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name *string `json:"name,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{"created", "modified", "name"}) - } else { - return err - } - o.Created = all.Created - o.Modified = all.Modified - o.Name = all.Name - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_response_data.go b/api/datadogV2/model_incident_service_response_data.go deleted file mode 100644 index 9233d6c942f..00000000000 --- a/api/datadogV2/model_incident_service_response_data.go +++ /dev/null @@ -1,221 +0,0 @@ -// 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" -) - -// IncidentServiceResponseData Incident Service data from responses. -type IncidentServiceResponseData struct { - // The incident service's attributes from a response. - Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` - // The incident service's ID. - Id string `json:"id"` - // The incident service's relationships. - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - // Incident service resource type. - Type IncidentServiceType `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:"-"` -} - -// NewIncidentServiceResponseData instantiates a new IncidentServiceResponseData 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 NewIncidentServiceResponseData(id string, typeVar IncidentServiceType) *IncidentServiceResponseData { - this := IncidentServiceResponseData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewIncidentServiceResponseDataWithDefaults instantiates a new IncidentServiceResponseData 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 NewIncidentServiceResponseDataWithDefaults() *IncidentServiceResponseData { - this := IncidentServiceResponseData{} - var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentServiceResponseData) GetAttributes() IncidentServiceResponseAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentServiceResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseData) GetAttributesOk() (*IncidentServiceResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentServiceResponseData) HasAttributes() bool { - return o != nil && o.Attributes != nil -} - -// SetAttributes gets a reference to the given IncidentServiceResponseAttributes and assigns it to the Attributes field. -func (o *IncidentServiceResponseData) SetAttributes(v IncidentServiceResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *IncidentServiceResponseData) 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 *IncidentServiceResponseData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *IncidentServiceResponseData) SetId(v string) { - o.Id = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentServiceResponseData) GetRelationships() IncidentServiceRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentServiceRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentServiceResponseData) HasRelationships() bool { - return o != nil && o.Relationships != nil -} - -// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. -func (o *IncidentServiceResponseData) SetRelationships(v IncidentServiceRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentServiceResponseData) GetType() IncidentServiceType { - if o == nil { - var ret IncidentServiceType - 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 *IncidentServiceResponseData) GetTypeOk() (*IncidentServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentServiceResponseData) SetType(v IncidentServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` - Id *string `json:"id"` - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type *IncidentServiceType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Id == nil { - return fmt.Errorf("required field id missing") - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) - } else { - return err - } - - hasInvalidField := false - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Attributes = all.Attributes - o.Id = *all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Relationships = all.Relationships - if !all.Type.IsValid() { - hasInvalidField = true - } else { - o.Type = *all.Type - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_type.go b/api/datadogV2/model_incident_service_type.go deleted file mode 100644 index 104eeca461b..00000000000 --- a/api/datadogV2/model_incident_service_type.go +++ /dev/null @@ -1,64 +0,0 @@ -// 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" -) - -// IncidentServiceType Incident service resource type. -type IncidentServiceType string - -// List of IncidentServiceType. -const ( - INCIDENTSERVICETYPE_SERVICES IncidentServiceType = "services" -) - -var allowedIncidentServiceTypeEnumValues = []IncidentServiceType{ - INCIDENTSERVICETYPE_SERVICES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentServiceType) GetAllowedValues() []IncidentServiceType { - return allowedIncidentServiceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentServiceType) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentServiceType(value) - return nil -} - -// NewIncidentServiceTypeFromValue returns a pointer to a valid IncidentServiceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentServiceTypeFromValue(v string) (*IncidentServiceType, error) { - ev := IncidentServiceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentServiceType: valid values are %v", v, allowedIncidentServiceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentServiceType) IsValid() bool { - for _, existing := range allowedIncidentServiceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentServiceType value. -func (v IncidentServiceType) Ptr() *IncidentServiceType { - return &v -} diff --git a/api/datadogV2/model_incident_service_update_attributes.go b/api/datadogV2/model_incident_service_update_attributes.go deleted file mode 100644 index 774c6596abb..00000000000 --- a/api/datadogV2/model_incident_service_update_attributes.go +++ /dev/null @@ -1,101 +0,0 @@ -// 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" -) - -// IncidentServiceUpdateAttributes The incident service's attributes for an update request. -type IncidentServiceUpdateAttributes struct { - // Name of the incident service. - Name string `json:"name"` - // 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:"-"` -} - -// NewIncidentServiceUpdateAttributes instantiates a new IncidentServiceUpdateAttributes 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 NewIncidentServiceUpdateAttributes(name string) *IncidentServiceUpdateAttributes { - this := IncidentServiceUpdateAttributes{} - this.Name = name - return &this -} - -// NewIncidentServiceUpdateAttributesWithDefaults instantiates a new IncidentServiceUpdateAttributes 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 NewIncidentServiceUpdateAttributesWithDefaults() *IncidentServiceUpdateAttributes { - this := IncidentServiceUpdateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *IncidentServiceUpdateAttributes) 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 *IncidentServiceUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *IncidentServiceUpdateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Name *string `json:"name"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Name == nil { - return fmt.Errorf("required field name missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"name"}) - } else { - return err - } - o.Name = *all.Name - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_update_data.go b/api/datadogV2/model_incident_service_update_data.go deleted file mode 100644 index 77f4b5da5c9..00000000000 --- a/api/datadogV2/model_incident_service_update_data.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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" -) - -// IncidentServiceUpdateData Incident Service payload for update requests. -type IncidentServiceUpdateData struct { - // The incident service's attributes for an update request. - Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` - // The incident service's ID. - Id *string `json:"id,omitempty"` - // The incident service's relationships. - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - // Incident service resource type. - Type IncidentServiceType `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:"-"` -} - -// NewIncidentServiceUpdateData instantiates a new IncidentServiceUpdateData 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 NewIncidentServiceUpdateData(typeVar IncidentServiceType) *IncidentServiceUpdateData { - this := IncidentServiceUpdateData{} - this.Type = typeVar - return &this -} - -// NewIncidentServiceUpdateDataWithDefaults instantiates a new IncidentServiceUpdateData 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 NewIncidentServiceUpdateDataWithDefaults() *IncidentServiceUpdateData { - this := IncidentServiceUpdateData{} - var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentServiceUpdateData) GetAttributes() IncidentServiceUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentServiceUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateData) GetAttributesOk() (*IncidentServiceUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentServiceUpdateData) HasAttributes() bool { - return o != nil && o.Attributes != nil -} - -// SetAttributes gets a reference to the given IncidentServiceUpdateAttributes and assigns it to the Attributes field. -func (o *IncidentServiceUpdateData) SetAttributes(v IncidentServiceUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *IncidentServiceUpdateData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *IncidentServiceUpdateData) HasId() bool { - return o != nil && o.Id != nil -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *IncidentServiceUpdateData) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentServiceUpdateData) GetRelationships() IncidentServiceRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentServiceRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentServiceUpdateData) HasRelationships() bool { - return o != nil && o.Relationships != nil -} - -// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. -func (o *IncidentServiceUpdateData) SetRelationships(v IncidentServiceRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentServiceUpdateData) GetType() IncidentServiceType { - if o == nil { - var ret IncidentServiceType - 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 *IncidentServiceUpdateData) GetTypeOk() (*IncidentServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentServiceUpdateData) SetType(v IncidentServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type *IncidentServiceType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) - } else { - return err - } - - hasInvalidField := false - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Relationships = all.Relationships - if !all.Type.IsValid() { - hasInvalidField = true - } else { - o.Type = *all.Type - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_incident_service_update_request.go b/api/datadogV2/model_incident_service_update_request.go deleted file mode 100644 index 1bb9e3f4755..00000000000 --- a/api/datadogV2/model_incident_service_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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" -) - -// IncidentServiceUpdateRequest Update request with an incident service payload. -type IncidentServiceUpdateRequest struct { - // Incident Service payload for update requests. - Data IncidentServiceUpdateData `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:"-"` -} - -// NewIncidentServiceUpdateRequest instantiates a new IncidentServiceUpdateRequest 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 NewIncidentServiceUpdateRequest(data IncidentServiceUpdateData) *IncidentServiceUpdateRequest { - this := IncidentServiceUpdateRequest{} - this.Data = data - return &this -} - -// NewIncidentServiceUpdateRequestWithDefaults instantiates a new IncidentServiceUpdateRequest 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 NewIncidentServiceUpdateRequestWithDefaults() *IncidentServiceUpdateRequest { - this := IncidentServiceUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServiceUpdateRequest) GetData() IncidentServiceUpdateData { - if o == nil { - var ret IncidentServiceUpdateData - 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 *IncidentServiceUpdateRequest) GetDataOk() (*IncidentServiceUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServiceUpdateRequest) SetData(v IncidentServiceUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceUpdateRequest) 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 *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Data *IncidentServiceUpdateData `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_incident_services_response.go b/api/datadogV2/model_incident_services_response.go deleted file mode 100644 index e4ec43f4134..00000000000 --- a/api/datadogV2/model_incident_services_response.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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" -) - -// IncidentServicesResponse Response with a list of incident service payloads. -type IncidentServicesResponse struct { - // An array of incident services. - Data []IncidentServiceResponseData `json:"data"` - // Included related resources which the user requested. - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - // The metadata object containing pagination metadata. - Meta *IncidentResponseMeta `json:"meta,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:"-"` -} - -// NewIncidentServicesResponse instantiates a new IncidentServicesResponse 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 NewIncidentServicesResponse(data []IncidentServiceResponseData) *IncidentServicesResponse { - this := IncidentServicesResponse{} - this.Data = data - return &this -} - -// NewIncidentServicesResponseWithDefaults instantiates a new IncidentServicesResponse 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 NewIncidentServicesResponseWithDefaults() *IncidentServicesResponse { - this := IncidentServicesResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServicesResponse) GetData() []IncidentServiceResponseData { - if o == nil { - var ret []IncidentServiceResponseData - 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 *IncidentServicesResponse) GetDataOk() (*[]IncidentServiceResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServicesResponse) SetData(v []IncidentServiceResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentServicesResponse) GetIncluded() []IncidentServiceIncludedItems { - if o == nil || o.Included == nil { - var ret []IncidentServiceIncludedItems - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServicesResponse) GetIncludedOk() (*[]IncidentServiceIncludedItems, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentServicesResponse) HasIncluded() bool { - return o != nil && o.Included != nil -} - -// SetIncluded gets a reference to the given []IncidentServiceIncludedItems and assigns it to the Included field. -func (o *IncidentServicesResponse) SetIncluded(v []IncidentServiceIncludedItems) { - o.Included = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *IncidentServicesResponse) GetMeta() IncidentResponseMeta { - if o == nil || o.Meta == nil { - var ret IncidentResponseMeta - return ret - } - return *o.Meta -} - -// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServicesResponse) GetMetaOk() (*IncidentResponseMeta, bool) { - if o == nil || o.Meta == nil { - return nil, false - } - return o.Meta, true -} - -// HasMeta returns a boolean if a field has been set. -func (o *IncidentServicesResponse) HasMeta() bool { - return o != nil && o.Meta != nil -} - -// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. -func (o *IncidentServicesResponse) SetMeta(v IncidentResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServicesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Data *[]IncidentServiceResponseData `json:"data"` - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - Meta *IncidentResponseMeta `json:"meta,omitempty"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Data == nil { - return fmt.Errorf("required field data missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) - } else { - return err - } - - hasInvalidField := false - o.Data = *all.Data - o.Included = all.Included - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Meta = all.Meta - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/examples/v2/incident-services/CreateIncidentService.go b/examples/v2/incident-services/CreateIncidentService.go deleted file mode 100644 index a454305ed41..00000000000 --- a/examples/v2/incident-services/CreateIncidentService.go +++ /dev/null @@ -1,38 +0,0 @@ -// Create a new incident service returns "CREATED" response - -package main - -import ( - "context" - "encoding/json" - "fmt" - "os" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" - "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" -) - -func main() { - body := datadogV2.IncidentServiceCreateRequest{ - Data: datadogV2.IncidentServiceCreateData{ - Type: datadogV2.INCIDENTSERVICETYPE_SERVICES, - Attributes: &datadogV2.IncidentServiceCreateAttributes{ - Name: "Example-Incident-Service", - }, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.CreateIncidentService", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewIncidentServicesApi(apiClient) - resp, r, err := api.CreateIncidentService(ctx, body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `IncidentServicesApi.CreateIncidentService`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `IncidentServicesApi.CreateIncidentService`:\n%s\n", responseContent) -} diff --git a/examples/v2/incident-services/DeleteIncidentService.go b/examples/v2/incident-services/DeleteIncidentService.go deleted file mode 100644 index 8081411c2d5..00000000000 --- a/examples/v2/incident-services/DeleteIncidentService.go +++ /dev/null @@ -1,29 +0,0 @@ -// Delete an existing incident service 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() { - // there is a valid "service" in the system - ServiceDataID := os.Getenv("SERVICE_DATA_ID") - - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.DeleteIncidentService", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewIncidentServicesApi(apiClient) - r, err := api.DeleteIncidentService(ctx, ServiceDataID) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `IncidentServicesApi.DeleteIncidentService`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} diff --git a/examples/v2/incident-services/GetIncidentService.go b/examples/v2/incident-services/GetIncidentService.go deleted file mode 100644 index 4850637a0de..00000000000 --- a/examples/v2/incident-services/GetIncidentService.go +++ /dev/null @@ -1,33 +0,0 @@ -// Get details of an incident service 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() { - // there is a valid "service" in the system - ServiceDataID := os.Getenv("SERVICE_DATA_ID") - - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.GetIncidentService", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewIncidentServicesApi(apiClient) - resp, r, err := api.GetIncidentService(ctx, ServiceDataID, *datadogV2.NewGetIncidentServiceOptionalParameters()) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `IncidentServicesApi.GetIncidentService`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `IncidentServicesApi.GetIncidentService`:\n%s\n", responseContent) -} diff --git a/examples/v2/incident-services/ListIncidentServices.go b/examples/v2/incident-services/ListIncidentServices.go deleted file mode 100644 index 610abafac44..00000000000 --- a/examples/v2/incident-services/ListIncidentServices.go +++ /dev/null @@ -1,33 +0,0 @@ -// Get a list of all incident services 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() { - // there is a valid "service" in the system - ServiceDataAttributesName := os.Getenv("SERVICE_DATA_ATTRIBUTES_NAME") - - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.ListIncidentServices", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewIncidentServicesApi(apiClient) - resp, r, err := api.ListIncidentServices(ctx, *datadogV2.NewListIncidentServicesOptionalParameters().WithFilter(ServiceDataAttributesName)) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `IncidentServicesApi.ListIncidentServices`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `IncidentServicesApi.ListIncidentServices`:\n%s\n", responseContent) -} diff --git a/examples/v2/incident-services/UpdateIncidentService.go b/examples/v2/incident-services/UpdateIncidentService.go deleted file mode 100644 index 9919320a890..00000000000 --- a/examples/v2/incident-services/UpdateIncidentService.go +++ /dev/null @@ -1,41 +0,0 @@ -// Update an existing incident service 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() { - // there is a valid "service" in the system - ServiceDataID := os.Getenv("SERVICE_DATA_ID") - - body := datadogV2.IncidentServiceUpdateRequest{ - Data: datadogV2.IncidentServiceUpdateData{ - Type: datadogV2.INCIDENTSERVICETYPE_SERVICES, - Attributes: &datadogV2.IncidentServiceUpdateAttributes{ - Name: "service name-updated", - }, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.UpdateIncidentService", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewIncidentServicesApi(apiClient) - resp, r, err := api.UpdateIncidentService(ctx, ServiceDataID, body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `IncidentServicesApi.UpdateIncidentService`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `IncidentServicesApi.UpdateIncidentService`:\n%s\n", responseContent) -} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index f9a2f1886d6..e6778798bbc 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -162,7 +162,6 @@ var apiMappings = map[string]map[string]reflect.Value{ "EntityRiskScoresApi": reflect.ValueOf(datadogV2.NewEntityRiskScoresApi), "SensitiveDataScannerApi": reflect.ValueOf(datadogV2.NewSensitiveDataScannerApi), "ServiceAccountsApi": reflect.ValueOf(datadogV2.NewServiceAccountsApi), - "IncidentServicesApi": reflect.ValueOf(datadogV2.NewIncidentServicesApi), "ServiceDefinitionApi": reflect.ValueOf(datadogV2.NewServiceDefinitionApi), "ServiceLevelObjectivesApi": reflect.ValueOf(datadogV2.NewServiceLevelObjectivesApi), "SpaApi": reflect.ValueOf(datadogV2.NewSpaApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.freeze deleted file mode 100644 index 1ed50bd7167..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2022-05-12T09:51:29.760Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.yaml deleted file mode 100644 index b8d1066fb8f..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Create_a_new_incident_service_returns_CREATED_response.yaml +++ /dev/null @@ -1,37 +0,0 @@ -interactions: -- request: - body: | - {"data":{"attributes":{"name":"Test-Create_a_new_incident_service_returns_CREATED_response-1652349089"},"type":"services"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://api.datadoghq.com/api/v2/services - response: - body: '{"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}],"data":{"type":"services","id":"aa4526fd-8084-58a0-bd52-164cd7f1a51e","attributes":{"name":"Test-Create_a_new_incident_service_returns_CREATED_response-1652349089","created":"2022-05-12T09:51:30.250528+00:00","modified":"2022-05-12T09:51:30.250528+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 201 - duration: 0ms - headers: - Content-Type: - - application/json - status: 201 Created -- request: - body: '' - form: {} - headers: - Accept: - - '*/*' - id: 1 - method: DELETE - url: https://api.datadoghq.com/api/v2/services/aa4526fd-8084-58a0-bd52-164cd7f1a51e - response: - body: '' - code: 204 - duration: 0ms - headers: {} - status: 204 No Content -version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.freeze deleted file mode 100644 index 6a8b97d928a..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2022-05-12T09:51:30.710Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.yaml deleted file mode 100644 index 5fbb5900abd..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Delete_an_existing_incident_service_returns_OK_response.yaml +++ /dev/null @@ -1,52 +0,0 @@ -interactions: -- request: - body: | - {"data":{"attributes":{"name":"Test-Delete_an_existing_incident_service_returns_OK_response-1652349090"},"type":"services"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://api.datadoghq.com/api/v2/services - response: - body: '{"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}],"data":{"type":"services","id":"9f42d0e5-438a-5808-bb84-01ede3c065fb","attributes":{"name":"Test-Delete_an_existing_incident_service_returns_OK_response-1652349090","created":"2022-05-12T09:51:31.181927+00:00","modified":"2022-05-12T09:51:31.181927+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 201 - duration: 0ms - headers: - Content-Type: - - application/json - status: 201 Created -- request: - body: '' - form: {} - headers: - Accept: - - '*/*' - id: 1 - method: DELETE - url: https://api.datadoghq.com/api/v2/services/9f42d0e5-438a-5808-bb84-01ede3c065fb - response: - body: '' - code: 204 - duration: 0ms - headers: {} - status: 204 No Content -- request: - body: '' - form: {} - headers: - Accept: - - '*/*' - id: 2 - method: DELETE - url: https://api.datadoghq.com/api/v2/services/9f42d0e5-438a-5808-bb84-01ede3c065fb - response: - body: '' - code: 204 - duration: 0ms - headers: {} - status: 204 No Content -version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.freeze deleted file mode 100644 index fe0e8ff0de3..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2022-05-12T09:51:32.124Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.yaml deleted file mode 100644 index ba42eca0ddc..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_a_list_of_all_incident_services_returns_OK_response.yaml +++ /dev/null @@ -1,54 +0,0 @@ -interactions: -- request: - body: | - {"data":{"attributes":{"name":"Test-Get_a_list_of_all_incident_services_returns_OK_response-1652349092"},"type":"services"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://api.datadoghq.com/api/v2/services - response: - body: '{"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}],"data":{"type":"services","id":"84fc985e-fd2b-5e37-b627-eee699786658","attributes":{"name":"Test-Get_a_list_of_all_incident_services_returns_OK_response-1652349092","created":"2022-05-12T09:51:32.548997+00:00","modified":"2022-05-12T09:51:32.548997+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 201 - duration: 0ms - headers: - Content-Type: - - application/json - status: 201 Created -- request: - body: '' - form: {} - headers: - Accept: - - application/json - id: 1 - method: GET - url: https://api.datadoghq.com/api/v2/services?filter=Test-Get_a_list_of_all_incident_services_returns_OK_response-1652349092 - response: - body: '{"meta":{"sort":"ASC","pagination":{"total":7805,"size":1,"next_offset":1,"offset":0},"total":7805},"data":[{"type":"services","id":"84fc985e-fd2b-5e37-b627-eee699786658","attributes":{"name":"Test-Get_a_list_of_all_incident_services_returns_OK_response-1652349092","created":"2022-05-12T09:51:32.548997+00:00","modified":"2022-05-12T09:51:32.548997+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}]}' - code: 200 - duration: 0ms - headers: - Content-Type: - - application/json - status: 200 OK -- request: - body: '' - form: {} - headers: - Accept: - - '*/*' - id: 2 - method: DELETE - url: https://api.datadoghq.com/api/v2/services/84fc985e-fd2b-5e37-b627-eee699786658 - response: - body: '' - code: 204 - duration: 0ms - headers: {} - status: 204 No Content -version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.freeze deleted file mode 100644 index 44bfb433190..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2022-05-12T09:51:33.610Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.yaml deleted file mode 100644 index 939f6887869..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Get_details_of_an_incident_service_returns_OK_response.yaml +++ /dev/null @@ -1,54 +0,0 @@ -interactions: -- request: - body: | - {"data":{"attributes":{"name":"Test-Get_details_of_an_incident_service_returns_OK_response-1652349093"},"type":"services"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://api.datadoghq.com/api/v2/services - response: - body: '{"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}],"data":{"type":"services","id":"e7c6527e-95ff-5ab1-b151-ba4f786038c0","attributes":{"name":"Test-Get_details_of_an_incident_service_returns_OK_response-1652349093","created":"2022-05-12T09:51:34.184497+00:00","modified":"2022-05-12T09:51:34.184497+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 201 - duration: 0ms - headers: - Content-Type: - - application/json - status: 201 Created -- request: - body: '' - form: {} - headers: - Accept: - - application/json - id: 1 - method: GET - url: https://api.datadoghq.com/api/v2/services/e7c6527e-95ff-5ab1-b151-ba4f786038c0 - response: - body: '{"data":{"type":"services","id":"e7c6527e-95ff-5ab1-b151-ba4f786038c0","attributes":{"name":"Test-Get_details_of_an_incident_service_returns_OK_response-1652349093","created":"2022-05-12T09:51:34.184497+00:00","modified":"2022-05-12T09:51:34.184497+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 200 - duration: 0ms - headers: - Content-Type: - - application/json - status: 200 OK -- request: - body: '' - form: {} - headers: - Accept: - - '*/*' - id: 2 - method: DELETE - url: https://api.datadoghq.com/api/v2/services/e7c6527e-95ff-5ab1-b151-ba4f786038c0 - response: - body: '' - code: 204 - duration: 0ms - headers: {} - status: 204 No Content -version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.freeze deleted file mode 100644 index 45de6e2ecb2..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2022-05-12T09:51:35.154Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.yaml deleted file mode 100644 index 4093b40852b..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Incident_Services/Scenario_Update_an_existing_incident_service_returns_OK_response.yaml +++ /dev/null @@ -1,57 +0,0 @@ -interactions: -- request: - body: | - {"data":{"attributes":{"name":"Test-Update_an_existing_incident_service_returns_OK_response-1652349095"},"type":"services"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://api.datadoghq.com/api/v2/services - response: - body: '{"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}],"data":{"type":"services","id":"f9f4467a-1e31-5513-83b8-ca6c4287a9b3","attributes":{"name":"Test-Update_an_existing_incident_service_returns_OK_response-1652349095","created":"2022-05-12T09:51:35.599056+00:00","modified":"2022-05-12T09:51:35.599056+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 201 - duration: 0ms - headers: - Content-Type: - - application/json - status: 201 Created -- request: - body: | - {"data":{"attributes":{"name":"Test-Update_an_existing_incident_service_returns_OK_response-1652349095-updated"},"type":"services"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 1 - method: PATCH - url: https://api.datadoghq.com/api/v2/services/f9f4467a-1e31-5513-83b8-ca6c4287a9b3 - response: - body: '{"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}],"data":{"type":"services","id":"f9f4467a-1e31-5513-83b8-ca6c4287a9b3","attributes":{"name":"Test-Update_an_existing_incident_service_returns_OK_response-1652349095-updated","created":"2022-05-12T09:51:35.599056+00:00","modified":"2022-05-12T09:51:36.165537+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}}' - code: 200 - duration: 0ms - headers: - Content-Type: - - application/json - status: 200 OK -- request: - body: '' - form: {} - headers: - Accept: - - '*/*' - id: 2 - method: DELETE - url: https://api.datadoghq.com/api/v2/services/f9f4467a-1e31-5513-83b8-ca6c4287a9b3 - response: - body: '' - code: 204 - duration: 0ms - headers: {} - status: 204 No Content -version: 2 diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 6b90cd6f657..fb03c29c057 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -1496,18 +1496,6 @@ "tag": "Service Accounts", "operationId": "CreateServiceAccountApplicationKey" }, - { - "parameters": [ - { - "name": "body", - "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\"\n },\n \"type\": \"services\"\n }\n}" - } - ], - "step": "there is a valid \"service\" in the system", - "key": "service", - "tag": "Incident Services", - "operationId": "CreateIncidentService" - }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/incident_services.feature b/tests/scenarios/features/v2/incident_services.feature deleted file mode 100644 index eb5e5716d42..00000000000 --- a/tests/scenarios/features/v2/incident_services.feature +++ /dev/null @@ -1,146 +0,0 @@ -@endpoint(incident-services) @endpoint(incident-services-v2) -Feature: Incident Services - Create, update, delete, and retrieve services which can be associated with - incidents. See the [Incident Management - page](https://docs.datadoghq.com/service_management/incident_management/) - for more information. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "IncidentServices" API - - @generated @skip @team:Datadog/incident-app - Scenario: Create a new incident service returns "Bad Request" response - Given operation "CreateIncidentService" enabled - And new "CreateIncidentService" request - And body with value {"data": {"attributes": {"name": "an example service name"}, "type": "services"}} - When the request is sent - Then the response status is 400 Bad Request - - @team:Datadog/incident-app - Scenario: Create a new incident service returns "CREATED" response - Given operation "CreateIncidentService" enabled - And new "CreateIncidentService" request - And body with value {"data": {"type": "services", "attributes": {"name": "{{ unique }}"}}} - When the request is sent - Then the response status is 201 CREATED - And the response "data.attributes.name" is equal to "{{ unique }}" - And the response "data.type" is equal to "services" - - @generated @skip @team:Datadog/incident-app - Scenario: Create a new incident service returns "Not Found" response - Given operation "CreateIncidentService" enabled - And new "CreateIncidentService" request - And body with value {"data": {"attributes": {"name": "an example service name"}, "type": "services"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:Datadog/incident-app - Scenario: Delete an existing incident service returns "Bad Request" response - Given operation "DeleteIncidentService" enabled - And new "DeleteIncidentService" request - And request contains "service_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:Datadog/incident-app - Scenario: Delete an existing incident service returns "Not Found" response - Given operation "DeleteIncidentService" enabled - And new "DeleteIncidentService" request - And request contains "service_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @team:Datadog/incident-app - Scenario: Delete an existing incident service returns "OK" response - Given there is a valid "service" in the system - And operation "DeleteIncidentService" enabled - And new "DeleteIncidentService" request - And request contains "service_id" parameter from "service.data.id" - When the request is sent - Then the response status is 204 OK - - @generated @skip @team:Datadog/incident-app - Scenario: Get a list of all incident services returns "Bad Request" response - Given operation "ListIncidentServices" enabled - And new "ListIncidentServices" request - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:Datadog/incident-app - Scenario: Get a list of all incident services returns "Not Found" response - Given operation "ListIncidentServices" enabled - And new "ListIncidentServices" request - When the request is sent - Then the response status is 404 Not Found - - @team:Datadog/incident-app - Scenario: Get a list of all incident services returns "OK" response - Given there is a valid "service" in the system - And operation "ListIncidentServices" enabled - And new "ListIncidentServices" request - And request contains "filter" parameter from "service.data.attributes.name" - When the request is sent - Then the response status is 200 OK - And the response "data" has length 1 - And the response "data[0].attributes.name" has the same value as "service.data.attributes.name" - - @generated @skip @team:Datadog/incident-app - Scenario: Get details of an incident service returns "Bad Request" response - Given operation "GetIncidentService" enabled - And new "GetIncidentService" request - And request contains "service_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:Datadog/incident-app - Scenario: Get details of an incident service returns "Not Found" response - Given operation "GetIncidentService" enabled - And new "GetIncidentService" request - And request contains "service_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @team:Datadog/incident-app - Scenario: Get details of an incident service returns "OK" response - Given there is a valid "service" in the system - And operation "GetIncidentService" enabled - And new "GetIncidentService" request - And request contains "service_id" parameter from "service.data.id" - When the request is sent - Then the response status is 200 OK - And the response "data.id" is equal to "{{service.data.id}}" - And the response "data.type" is equal to "services" - And the response "data.attributes.name" has the same value as "service.data.attributes.name" - - @generated @skip @team:Datadog/incident-app - Scenario: Update an existing incident service returns "Bad Request" response - Given operation "UpdateIncidentService" enabled - And new "UpdateIncidentService" request - And request contains "service_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"name": "an example service name"}, "id": "00000000-0000-0000-0000-000000000000", "type": "services"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:Datadog/incident-app - Scenario: Update an existing incident service returns "Not Found" response - Given operation "UpdateIncidentService" enabled - And new "UpdateIncidentService" request - And request contains "service_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"name": "an example service name"}, "id": "00000000-0000-0000-0000-000000000000", "type": "services"}} - When the request is sent - Then the response status is 404 Not Found - - @team:Datadog/incident-app - Scenario: Update an existing incident service returns "OK" response - Given there is a valid "service" in the system - And operation "UpdateIncidentService" enabled - And new "UpdateIncidentService" request - And request contains "service_id" parameter from "service.data.id" - And body with value {"data": {"type": "services", "attributes": {"name": "{{ service.data.attributes.name }}-updated"}}} - When the request is sent - Then the response status is 200 OK - And the response "data.id" is equal to "{{service.data.id}}" - And the response "data.type" is equal to "services" - And the response "data.attributes.name" is equal to "{{ service.data.attributes.name }}-updated" diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 3a15f0b470c..d32b680345c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -7762,25 +7762,6 @@ "type": "idempotent" } }, - "ListIncidentServices": { - "tag": "Incident Services", - "undo": { - "type": "safe" - } - }, - "CreateIncidentService": { - "tag": "Incident Services", - "undo": { - "operationId": "DeleteIncidentService", - "parameters": [ - { - "name": "service_id", - "source": "data.id" - } - ], - "type": "unsafe" - } - }, "ListServiceDefinitions": { "tag": "Service Definition", "undo": { @@ -7812,24 +7793,6 @@ "type": "safe" } }, - "DeleteIncidentService": { - "tag": "Incident Services", - "undo": { - "type": "idempotent" - } - }, - "GetIncidentService": { - "tag": "Incident Services", - "undo": { - "type": "safe" - } - }, - "UpdateIncidentService": { - "tag": "Incident Services", - "undo": { - "type": "idempotent" - } - }, "ListSecurityMonitoringHistsignals": { "tag": "Security Monitoring", "undo": { From e86668812c8a831f7ab007cf74833521a9ee9e2b Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 18:57:57 +0000 Subject: [PATCH 2/5] Regenerate client from commit bd2edc1 of spec repo (#4182) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 239 +++++++++++++++ api/datadog/configuration.go | 2 +- api/datadogV2/api_organizations.go | 174 +++++++++++ api/datadogV2/doc.go | 1 + api/datadogV2/model_global_org.go | 227 +++++++++++++++ api/datadogV2/model_global_org_attributes.go | 223 ++++++++++++++ api/datadogV2/model_global_org_data.go | 146 ++++++++++ api/datadogV2/model_global_org_type.go | 64 ++++ api/datadogV2/model_global_org_user.go | 135 +++++++++ api/datadogV2/model_global_orgs_links.go | 194 +++++++++++++ api/datadogV2/model_global_orgs_meta.go | 111 +++++++ api/datadogV2/model_global_orgs_meta_page.go | 274 ++++++++++++++++++ .../model_global_orgs_meta_page_type.go | 64 ++++ api/datadogV2/model_global_orgs_response.go | 183 ++++++++++++ examples/v2/organizations/ListGlobalOrgs.go | 29 ++ .../organizations/ListGlobalOrgs_465966063.go | 29 ++ tests/scenarios/api_mappings.go | 2 +- .../features/v2/organizations.feature | 21 ++ tests/scenarios/features/v2/undo.json | 6 + 19 files changed, 2122 insertions(+), 2 deletions(-) create mode 100644 api/datadogV2/model_global_org.go create mode 100644 api/datadogV2/model_global_org_attributes.go create mode 100644 api/datadogV2/model_global_org_data.go create mode 100644 api/datadogV2/model_global_org_type.go create mode 100644 api/datadogV2/model_global_org_user.go create mode 100644 api/datadogV2/model_global_orgs_links.go create mode 100644 api/datadogV2/model_global_orgs_meta.go create mode 100644 api/datadogV2/model_global_orgs_meta_page.go create mode 100644 api/datadogV2/model_global_orgs_meta_page_type.go create mode 100644 api/datadogV2/model_global_orgs_response.go create mode 100644 examples/v2/organizations/ListGlobalOrgs.go create mode 100644 examples/v2/organizations/ListGlobalOrgs_465966063.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3b3cdf42c0c..ad7921d9bc3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -39913,6 +39913,64 @@ components: type: string x-enum-varnames: - INCIDENTS_GLOBAL_SETTINGS + GlobalOrg: + description: Organization information for a global organization association. + properties: + name: + description: The name of the organization. + example: Example Org + type: string + public_id: + description: The public identifier of the organization. + example: abcdef12345 + nullable: true + type: string + subdomain: + description: The subdomain used to access the organization, if configured. + example: example + nullable: true + type: string + uuid: + description: The UUID of the organization. + example: "13d10a96-6ff2-49be-be7b-4f56ebb13335" + format: uuid + type: string + required: + - uuid + - name + type: object + GlobalOrgAttributes: + description: Attributes of an organization associated with the authenticated user. + properties: + org: + $ref: "#/components/schemas/GlobalOrg" + redirect_url: + description: The login URL used to switch into the organization, if available. + example: "https://app.datadoghq.com/account/login/password?dd_oid=13d10a96-6ff2-49be-be7b-4f56ebb13335&login_hint=user%40example.com" + nullable: true + type: string + source_region: + description: The source region of the organization. + example: us1.prod.dog + type: string + user: + $ref: "#/components/schemas/GlobalOrgUser" + required: + - user + - org + - source_region + type: object + GlobalOrgData: + description: An organization associated with the authenticated user. + properties: + attributes: + $ref: "#/components/schemas/GlobalOrgAttributes" + type: + $ref: "#/components/schemas/GlobalOrgType" + required: + - type + - attributes + type: object GlobalOrgIdentifier: description: A unique identifier for an organization including its site. properties: @@ -39929,6 +39987,99 @@ components: - org_uuid - org_site type: object + GlobalOrgType: + description: The resource type for global user organizations. + enum: [global_user_orgs] + example: global_user_orgs + type: string + x-enum-varnames: + - GLOBAL_USER_ORGS + GlobalOrgUser: + description: User information for a global organization association. + properties: + handle: + description: The handle of the user. + example: user@example.com + type: string + uuid: + description: The UUID of the user. + example: "cfab5cf9-5472-48ea-a79c-a64045f4f745" + format: uuid + type: string + required: + - uuid + - handle + type: object + GlobalOrgsLinks: + description: Pagination links. + properties: + next: + description: Link to the next page. + example: "https://app.datadoghq.com/api/v2/global_orgs?user_handle=user@example.com&page[limit]=100&page[cursor]=next-page" + nullable: true + type: string + prev: + description: Link to the previous page. + nullable: true + type: string + self: + description: Link to the current page. + example: "https://app.datadoghq.com/api/v2/global_orgs?user_handle=user@example.com&page[limit]=100" + type: string + type: object + GlobalOrgsMeta: + description: Response metadata object. + properties: + page: + $ref: "#/components/schemas/GlobalOrgsMetaPage" + type: object + GlobalOrgsMetaPage: + description: Paging attributes. + properties: + cursor: + description: The cursor used to get the current results, if any. + example: "" + type: string + limit: + description: Number of results returned. + example: 100 + format: int32 + maximum: 1000 + type: integer + next_cursor: + description: The cursor used to get the next results, if any. + example: next-page + nullable: true + type: string + prev_cursor: + description: The cursor used to get the previous results, if any. + nullable: true + type: string + type: + $ref: "#/components/schemas/GlobalOrgsMetaPageType" + type: object + GlobalOrgsMetaPageType: + description: Type of global orgs pagination. + enum: [cursor] + example: cursor + type: string + x-enum-varnames: + - CURSOR + GlobalOrgsResponse: + description: Response containing organizations across regions for the authenticated user. + properties: + data: + description: Organizations across regions for the authenticated user. + items: + $ref: "#/components/schemas/GlobalOrgData" + type: array + links: + $ref: "#/components/schemas/GlobalOrgsLinks" + meta: + $ref: "#/components/schemas/GlobalOrgsMeta" + required: + - data + type: object GlobalVariableData: description: Synthetics global variable data. Wrapper around the global variable object. properties: @@ -129537,6 +129688,94 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/global_orgs: + get: + description: |- + Returns organizations across regions for the authenticated user. The `user_handle` query parameter must match the authenticated user's handle. + operationId: ListGlobalOrgs + parameters: + - description: The handle of the authenticated user. + in: query + name: user_handle + required: true + schema: + example: user@example.com + type: string + - description: Maximum number of results returned. + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int32 + maximum: 1000 + minimum: 1 + type: integer + - description: |- + String to query the next page of results. + This key is provided with each valid response from the API in `meta.page.next_cursor`. + in: query + name: page[cursor] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + org: + name: Example Org + public_id: abcdef12345 + subdomain: example + uuid: "13d10a96-6ff2-49be-be7b-4f56ebb13335" + redirect_url: "https://app.datadoghq.com/account/login/password?dd_oid=13d10a96-6ff2-49be-be7b-4f56ebb13335&login_hint=user%40example.com" + source_region: us1.prod.dog + user: + handle: user@example.com + uuid: "cfab5cf9-5472-48ea-a79c-a64045f4f745" + type: global_user_orgs + links: + next: "https://app.datadoghq.com/api/v2/global_orgs?user_handle=user@example.com&page[limit]=100&page[cursor]=next-page" + self: "https://app.datadoghq.com/api/v2/global_orgs?user_handle=user@example.com&page[limit]=100" + meta: + page: + cursor: "" + limit: 100 + next_cursor: next-page + type: cursor + schema: + $ref: "#/components/schemas/GlobalOrgsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_read + summary: List global orgs + tags: + - Organizations + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.page.next_cursor + limitParam: page[limit] + resultsPath: data + "x-permission": + operator: OR + permissions: + - user_access_read /api/v2/hamr: get: description: |- diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index a1bdac7d166..010a83ebd6a 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -919,6 +919,7 @@ func NewConfiguration() *Configuration { "v2.UpdateForm": false, "v2.UpsertAndPublishFormVersion": false, "v2.UpsertFormVersion": false, + "v2.UpdateOrgSamlConfigurations": false, "v2.CreateHamrOrgConnection": false, "v2.GetHamrOrgConnection": false, "v2.DeleteEntityIntegrationConfig": false, @@ -1031,7 +1032,6 @@ func NewConfiguration() *Configuration { "v2.GetScopesRestriction": false, "v2.RegisterOAuthClient": false, "v2.UpsertScopesRestriction": false, - "v2.UpdateOrgSamlConfigurations": false, "v2.DisableCustomerOrg": false, "v2.BulkUpdateOrgGroupMemberships": false, "v2.CreateOrgGroup": false, diff --git a/api/datadogV2/api_organizations.go b/api/datadogV2/api_organizations.go index 8b1bc9927c4..fdb365ceac4 100644 --- a/api/datadogV2/api_organizations.go +++ b/api/datadogV2/api_organizations.go @@ -174,6 +174,180 @@ func (a *OrganizationsApi) GetSAMLConfiguration(ctx _context.Context, samlConfig return localVarReturnValue, localVarHTTPResponse, nil } +// ListGlobalOrgsOptionalParameters holds optional parameters for ListGlobalOrgs. +type ListGlobalOrgsOptionalParameters struct { + PageLimit *int32 + PageCursor *string +} + +// NewListGlobalOrgsOptionalParameters creates an empty struct for parameters. +func NewListGlobalOrgsOptionalParameters() *ListGlobalOrgsOptionalParameters { + this := ListGlobalOrgsOptionalParameters{} + return &this +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListGlobalOrgsOptionalParameters) WithPageLimit(pageLimit int32) *ListGlobalOrgsOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListGlobalOrgsOptionalParameters) WithPageCursor(pageCursor string) *ListGlobalOrgsOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// ListGlobalOrgs List global orgs. +// Returns organizations across regions for the authenticated user. The `user_handle` query parameter must match the authenticated user's handle. +func (a *OrganizationsApi) ListGlobalOrgs(ctx _context.Context, userHandle string, o ...ListGlobalOrgsOptionalParameters) (GlobalOrgsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue GlobalOrgsResponse + optionalParams ListGlobalOrgsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListGlobalOrgsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OrganizationsApi.ListGlobalOrgs") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/global_orgs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarQueryParams.Add("user_handle", datadog.ParameterToString(userHandle, "")) + if optionalParams.PageLimit != nil { + localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, "")) + } + if optionalParams.PageCursor != nil { + localVarQueryParams.Add("page[cursor]", datadog.ParameterToString(*optionalParams.PageCursor, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 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 +} + +// ListGlobalOrgsWithPagination provides a paginated version of ListGlobalOrgs returning a channel with all items. +func (a *OrganizationsApi) ListGlobalOrgsWithPagination(ctx _context.Context, userHandle string, o ...ListGlobalOrgsOptionalParameters) (<-chan datadog.PaginationResult[GlobalOrgData], func()) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(100) + if len(o) == 0 { + o = append(o, ListGlobalOrgsOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan datadog.PaginationResult[GlobalOrgData], pageSize_) + go func() { + for { + resp, _, err := a.ListGlobalOrgs(ctx, userHandle, o...) + if err != nil { + var returnItem GlobalOrgData + items <- datadog.PaginationResult[GlobalOrgData]{Item: returnItem, Error: err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- datadog.PaginationResult[GlobalOrgData]{Item: item, Error: nil}: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) == 0 { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageNextCursor, ok := cursorMetaPage.GetNextCursorOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageNextCursor + } + close(items) + }() + return items, cancel +} + // ListOrgConfigs List Org Configs. // Returns all Org Configs (name, description, and value). func (a *OrganizationsApi) ListOrgConfigs(ctx _context.Context) (OrgConfigListResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 072b51c13cc..54e91afe438 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -816,6 +816,7 @@ // - [OrgGroupsApi.UpdateOrgGroupPolicyOverride] // - [OrganizationsApi.GetOrgConfig] // - [OrganizationsApi.GetSAMLConfiguration] +// - [OrganizationsApi.ListGlobalOrgs] // - [OrganizationsApi.ListOrgConfigs] // - [OrganizationsApi.ListOrgs] // - [OrganizationsApi.ListSAMLConfigurations] diff --git a/api/datadogV2/model_global_org.go b/api/datadogV2/model_global_org.go new file mode 100644 index 00000000000..99e261dc03a --- /dev/null +++ b/api/datadogV2/model_global_org.go @@ -0,0 +1,227 @@ +// 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" +) + +// GlobalOrg Organization information for a global organization association. +type GlobalOrg struct { + // The name of the organization. + Name string `json:"name"` + // The public identifier of the organization. + PublicId datadog.NullableString `json:"public_id,omitempty"` + // The subdomain used to access the organization, if configured. + Subdomain datadog.NullableString `json:"subdomain,omitempty"` + // The UUID of the organization. + Uuid uuid.UUID `json:"uuid"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGlobalOrg instantiates a new GlobalOrg 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 NewGlobalOrg(name string, uuid uuid.UUID) *GlobalOrg { + this := GlobalOrg{} + this.Name = name + this.Uuid = uuid + return &this +} + +// NewGlobalOrgWithDefaults instantiates a new GlobalOrg 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 NewGlobalOrgWithDefaults() *GlobalOrg { + this := GlobalOrg{} + return &this +} + +// GetName returns the Name field value. +func (o *GlobalOrg) 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 *GlobalOrg) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *GlobalOrg) SetName(v string) { + o.Name = v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrg) GetPublicId() string { + if o == nil || o.PublicId.Get() == nil { + var ret string + return ret + } + return *o.PublicId.Get() +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrg) GetPublicIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PublicId.Get(), o.PublicId.IsSet() +} + +// HasPublicId returns a boolean if a field has been set. +func (o *GlobalOrg) HasPublicId() bool { + return o != nil && o.PublicId.IsSet() +} + +// SetPublicId gets a reference to the given datadog.NullableString and assigns it to the PublicId field. +func (o *GlobalOrg) SetPublicId(v string) { + o.PublicId.Set(&v) +} + +// SetPublicIdNil sets the value for PublicId to be an explicit nil. +func (o *GlobalOrg) SetPublicIdNil() { + o.PublicId.Set(nil) +} + +// UnsetPublicId ensures that no value is present for PublicId, not even an explicit nil. +func (o *GlobalOrg) UnsetPublicId() { + o.PublicId.Unset() +} + +// GetSubdomain returns the Subdomain field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrg) GetSubdomain() string { + if o == nil || o.Subdomain.Get() == nil { + var ret string + return ret + } + return *o.Subdomain.Get() +} + +// GetSubdomainOk returns a tuple with the Subdomain field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrg) GetSubdomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Subdomain.Get(), o.Subdomain.IsSet() +} + +// HasSubdomain returns a boolean if a field has been set. +func (o *GlobalOrg) HasSubdomain() bool { + return o != nil && o.Subdomain.IsSet() +} + +// SetSubdomain gets a reference to the given datadog.NullableString and assigns it to the Subdomain field. +func (o *GlobalOrg) SetSubdomain(v string) { + o.Subdomain.Set(&v) +} + +// SetSubdomainNil sets the value for Subdomain to be an explicit nil. +func (o *GlobalOrg) SetSubdomainNil() { + o.Subdomain.Set(nil) +} + +// UnsetSubdomain ensures that no value is present for Subdomain, not even an explicit nil. +func (o *GlobalOrg) UnsetSubdomain() { + o.Subdomain.Unset() +} + +// GetUuid returns the Uuid field value. +func (o *GlobalOrg) GetUuid() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *GlobalOrg) GetUuidOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *GlobalOrg) SetUuid(v uuid.UUID) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrg) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.PublicId.IsSet() { + toSerialize["public_id"] = o.PublicId.Get() + } + if o.Subdomain.IsSet() { + toSerialize["subdomain"] = o.Subdomain.Get() + } + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrg) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + PublicId datadog.NullableString `json:"public_id,omitempty"` + Subdomain datadog.NullableString `json:"subdomain,omitempty"` + Uuid *uuid.UUID `json:"uuid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "public_id", "subdomain", "uuid"}) + } else { + return err + } + o.Name = *all.Name + o.PublicId = all.PublicId + o.Subdomain = all.Subdomain + o.Uuid = *all.Uuid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_global_org_attributes.go b/api/datadogV2/model_global_org_attributes.go new file mode 100644 index 00000000000..cc24db6db1a --- /dev/null +++ b/api/datadogV2/model_global_org_attributes.go @@ -0,0 +1,223 @@ +// 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" +) + +// GlobalOrgAttributes Attributes of an organization associated with the authenticated user. +type GlobalOrgAttributes struct { + // Organization information for a global organization association. + Org GlobalOrg `json:"org"` + // The login URL used to switch into the organization, if available. + RedirectUrl datadog.NullableString `json:"redirect_url,omitempty"` + // The source region of the organization. + SourceRegion string `json:"source_region"` + // User information for a global organization association. + User GlobalOrgUser `json:"user"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGlobalOrgAttributes instantiates a new GlobalOrgAttributes 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 NewGlobalOrgAttributes(org GlobalOrg, sourceRegion string, user GlobalOrgUser) *GlobalOrgAttributes { + this := GlobalOrgAttributes{} + this.Org = org + this.SourceRegion = sourceRegion + this.User = user + return &this +} + +// NewGlobalOrgAttributesWithDefaults instantiates a new GlobalOrgAttributes 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 NewGlobalOrgAttributesWithDefaults() *GlobalOrgAttributes { + this := GlobalOrgAttributes{} + return &this +} + +// GetOrg returns the Org field value. +func (o *GlobalOrgAttributes) GetOrg() GlobalOrg { + if o == nil { + var ret GlobalOrg + return ret + } + return o.Org +} + +// GetOrgOk returns a tuple with the Org field value +// and a boolean to check if the value has been set. +func (o *GlobalOrgAttributes) GetOrgOk() (*GlobalOrg, bool) { + if o == nil { + return nil, false + } + return &o.Org, true +} + +// SetOrg sets field value. +func (o *GlobalOrgAttributes) SetOrg(v GlobalOrg) { + o.Org = v +} + +// GetRedirectUrl returns the RedirectUrl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrgAttributes) GetRedirectUrl() string { + if o == nil || o.RedirectUrl.Get() == nil { + var ret string + return ret + } + return *o.RedirectUrl.Get() +} + +// GetRedirectUrlOk returns a tuple with the RedirectUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrgAttributes) GetRedirectUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RedirectUrl.Get(), o.RedirectUrl.IsSet() +} + +// HasRedirectUrl returns a boolean if a field has been set. +func (o *GlobalOrgAttributes) HasRedirectUrl() bool { + return o != nil && o.RedirectUrl.IsSet() +} + +// SetRedirectUrl gets a reference to the given datadog.NullableString and assigns it to the RedirectUrl field. +func (o *GlobalOrgAttributes) SetRedirectUrl(v string) { + o.RedirectUrl.Set(&v) +} + +// SetRedirectUrlNil sets the value for RedirectUrl to be an explicit nil. +func (o *GlobalOrgAttributes) SetRedirectUrlNil() { + o.RedirectUrl.Set(nil) +} + +// UnsetRedirectUrl ensures that no value is present for RedirectUrl, not even an explicit nil. +func (o *GlobalOrgAttributes) UnsetRedirectUrl() { + o.RedirectUrl.Unset() +} + +// GetSourceRegion returns the SourceRegion field value. +func (o *GlobalOrgAttributes) GetSourceRegion() string { + if o == nil { + var ret string + return ret + } + return o.SourceRegion +} + +// GetSourceRegionOk returns a tuple with the SourceRegion field value +// and a boolean to check if the value has been set. +func (o *GlobalOrgAttributes) GetSourceRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SourceRegion, true +} + +// SetSourceRegion sets field value. +func (o *GlobalOrgAttributes) SetSourceRegion(v string) { + o.SourceRegion = v +} + +// GetUser returns the User field value. +func (o *GlobalOrgAttributes) GetUser() GlobalOrgUser { + if o == nil { + var ret GlobalOrgUser + return ret + } + return o.User +} + +// GetUserOk returns a tuple with the User field value +// and a boolean to check if the value has been set. +func (o *GlobalOrgAttributes) GetUserOk() (*GlobalOrgUser, bool) { + if o == nil { + return nil, false + } + return &o.User, true +} + +// SetUser sets field value. +func (o *GlobalOrgAttributes) SetUser(v GlobalOrgUser) { + o.User = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["org"] = o.Org + if o.RedirectUrl.IsSet() { + toSerialize["redirect_url"] = o.RedirectUrl.Get() + } + toSerialize["source_region"] = o.SourceRegion + toSerialize["user"] = o.User + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Org *GlobalOrg `json:"org"` + RedirectUrl datadog.NullableString `json:"redirect_url,omitempty"` + SourceRegion *string `json:"source_region"` + User *GlobalOrgUser `json:"user"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Org == nil { + return fmt.Errorf("required field org missing") + } + if all.SourceRegion == nil { + return fmt.Errorf("required field source_region missing") + } + if all.User == nil { + return fmt.Errorf("required field user missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"org", "redirect_url", "source_region", "user"}) + } else { + return err + } + + hasInvalidField := false + if all.Org.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Org = *all.Org + o.RedirectUrl = all.RedirectUrl + o.SourceRegion = *all.SourceRegion + if all.User.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.User = *all.User + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_global_org_data.go b/api/datadogV2/model_global_org_data.go new file mode 100644 index 00000000000..e23a51524ab --- /dev/null +++ b/api/datadogV2/model_global_org_data.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GlobalOrgData An organization associated with the authenticated user. +type GlobalOrgData struct { + // Attributes of an organization associated with the authenticated user. + Attributes GlobalOrgAttributes `json:"attributes"` + // The resource type for global user organizations. + Type GlobalOrgType `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:"-"` +} + +// NewGlobalOrgData instantiates a new GlobalOrgData 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 NewGlobalOrgData(attributes GlobalOrgAttributes, typeVar GlobalOrgType) *GlobalOrgData { + this := GlobalOrgData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewGlobalOrgDataWithDefaults instantiates a new GlobalOrgData 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 NewGlobalOrgDataWithDefaults() *GlobalOrgData { + this := GlobalOrgData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *GlobalOrgData) GetAttributes() GlobalOrgAttributes { + if o == nil { + var ret GlobalOrgAttributes + 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 *GlobalOrgData) GetAttributesOk() (*GlobalOrgAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *GlobalOrgData) SetAttributes(v GlobalOrgAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *GlobalOrgData) GetType() GlobalOrgType { + if o == nil { + var ret GlobalOrgType + 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 *GlobalOrgData) GetTypeOk() (*GlobalOrgType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GlobalOrgData) SetType(v GlobalOrgType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgData) 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 *GlobalOrgData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GlobalOrgAttributes `json:"attributes"` + Type *GlobalOrgType `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_global_org_type.go b/api/datadogV2/model_global_org_type.go new file mode 100644 index 00000000000..e003e290e2f --- /dev/null +++ b/api/datadogV2/model_global_org_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" +) + +// GlobalOrgType The resource type for global user organizations. +type GlobalOrgType string + +// List of GlobalOrgType. +const ( + GLOBALORGTYPE_GLOBAL_USER_ORGS GlobalOrgType = "global_user_orgs" +) + +var allowedGlobalOrgTypeEnumValues = []GlobalOrgType{ + GLOBALORGTYPE_GLOBAL_USER_ORGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GlobalOrgType) GetAllowedValues() []GlobalOrgType { + return allowedGlobalOrgTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GlobalOrgType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GlobalOrgType(value) + return nil +} + +// NewGlobalOrgTypeFromValue returns a pointer to a valid GlobalOrgType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGlobalOrgTypeFromValue(v string) (*GlobalOrgType, error) { + ev := GlobalOrgType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GlobalOrgType: valid values are %v", v, allowedGlobalOrgTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GlobalOrgType) IsValid() bool { + for _, existing := range allowedGlobalOrgTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GlobalOrgType value. +func (v GlobalOrgType) Ptr() *GlobalOrgType { + return &v +} diff --git a/api/datadogV2/model_global_org_user.go b/api/datadogV2/model_global_org_user.go new file mode 100644 index 00000000000..5bbbebce975 --- /dev/null +++ b/api/datadogV2/model_global_org_user.go @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GlobalOrgUser User information for a global organization association. +type GlobalOrgUser struct { + // The handle of the user. + Handle string `json:"handle"` + // The UUID of the user. + Uuid uuid.UUID `json:"uuid"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGlobalOrgUser instantiates a new GlobalOrgUser 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 NewGlobalOrgUser(handle string, uuid uuid.UUID) *GlobalOrgUser { + this := GlobalOrgUser{} + this.Handle = handle + this.Uuid = uuid + return &this +} + +// NewGlobalOrgUserWithDefaults instantiates a new GlobalOrgUser 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 NewGlobalOrgUserWithDefaults() *GlobalOrgUser { + this := GlobalOrgUser{} + return &this +} + +// GetHandle returns the Handle field value. +func (o *GlobalOrgUser) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *GlobalOrgUser) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *GlobalOrgUser) SetHandle(v string) { + o.Handle = v +} + +// GetUuid returns the Uuid field value. +func (o *GlobalOrgUser) GetUuid() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *GlobalOrgUser) GetUuidOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *GlobalOrgUser) SetUuid(v uuid.UUID) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["handle"] = o.Handle + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrgUser) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle"` + Uuid *uuid.UUID `json:"uuid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "uuid"}) + } else { + return err + } + o.Handle = *all.Handle + o.Uuid = *all.Uuid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_global_orgs_links.go b/api/datadogV2/model_global_orgs_links.go new file mode 100644 index 00000000000..68f09958439 --- /dev/null +++ b/api/datadogV2/model_global_orgs_links.go @@ -0,0 +1,194 @@ +// 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" +) + +// GlobalOrgsLinks Pagination links. +type GlobalOrgsLinks struct { + // Link to the next page. + Next datadog.NullableString `json:"next,omitempty"` + // Link to the previous page. + Prev datadog.NullableString `json:"prev,omitempty"` + // Link to the current page. + Self *string `json:"self,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:"-"` +} + +// NewGlobalOrgsLinks instantiates a new GlobalOrgsLinks 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 NewGlobalOrgsLinks() *GlobalOrgsLinks { + this := GlobalOrgsLinks{} + return &this +} + +// NewGlobalOrgsLinksWithDefaults instantiates a new GlobalOrgsLinks 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 NewGlobalOrgsLinksWithDefaults() *GlobalOrgsLinks { + this := GlobalOrgsLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrgsLinks) GetNext() string { + if o == nil || o.Next.Get() == nil { + var ret string + return ret + } + return *o.Next.Get() +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrgsLinks) GetNextOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Next.Get(), o.Next.IsSet() +} + +// HasNext returns a boolean if a field has been set. +func (o *GlobalOrgsLinks) HasNext() bool { + return o != nil && o.Next.IsSet() +} + +// SetNext gets a reference to the given datadog.NullableString and assigns it to the Next field. +func (o *GlobalOrgsLinks) SetNext(v string) { + o.Next.Set(&v) +} + +// SetNextNil sets the value for Next to be an explicit nil. +func (o *GlobalOrgsLinks) SetNextNil() { + o.Next.Set(nil) +} + +// UnsetNext ensures that no value is present for Next, not even an explicit nil. +func (o *GlobalOrgsLinks) UnsetNext() { + o.Next.Unset() +} + +// GetPrev returns the Prev field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrgsLinks) GetPrev() string { + if o == nil || o.Prev.Get() == nil { + var ret string + return ret + } + return *o.Prev.Get() +} + +// GetPrevOk returns a tuple with the Prev field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrgsLinks) GetPrevOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Prev.Get(), o.Prev.IsSet() +} + +// HasPrev returns a boolean if a field has been set. +func (o *GlobalOrgsLinks) HasPrev() bool { + return o != nil && o.Prev.IsSet() +} + +// SetPrev gets a reference to the given datadog.NullableString and assigns it to the Prev field. +func (o *GlobalOrgsLinks) SetPrev(v string) { + o.Prev.Set(&v) +} + +// SetPrevNil sets the value for Prev to be an explicit nil. +func (o *GlobalOrgsLinks) SetPrevNil() { + o.Prev.Set(nil) +} + +// UnsetPrev ensures that no value is present for Prev, not even an explicit nil. +func (o *GlobalOrgsLinks) UnsetPrev() { + o.Prev.Unset() +} + +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *GlobalOrgsLinks) GetSelf() string { + if o == nil || o.Self == nil { + var ret string + return ret + } + return *o.Self +} + +// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsLinks) GetSelfOk() (*string, bool) { + if o == nil || o.Self == nil { + return nil, false + } + return o.Self, true +} + +// HasSelf returns a boolean if a field has been set. +func (o *GlobalOrgsLinks) HasSelf() bool { + return o != nil && o.Self != nil +} + +// SetSelf gets a reference to the given string and assigns it to the Self field. +func (o *GlobalOrgsLinks) SetSelf(v string) { + o.Self = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgsLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Next.IsSet() { + toSerialize["next"] = o.Next.Get() + } + if o.Prev.IsSet() { + toSerialize["prev"] = o.Prev.Get() + } + if o.Self != nil { + toSerialize["self"] = o.Self + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrgsLinks) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Next datadog.NullableString `json:"next,omitempty"` + Prev datadog.NullableString `json:"prev,omitempty"` + Self *string `json:"self,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{"next", "prev", "self"}) + } else { + return err + } + o.Next = all.Next + o.Prev = all.Prev + o.Self = all.Self + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_global_orgs_meta.go b/api/datadogV2/model_global_orgs_meta.go new file mode 100644 index 00000000000..5e934bf1850 --- /dev/null +++ b/api/datadogV2/model_global_orgs_meta.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GlobalOrgsMeta Response metadata object. +type GlobalOrgsMeta struct { + // Paging attributes. + Page *GlobalOrgsMetaPage `json:"page,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:"-"` +} + +// NewGlobalOrgsMeta instantiates a new GlobalOrgsMeta 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 NewGlobalOrgsMeta() *GlobalOrgsMeta { + this := GlobalOrgsMeta{} + return &this +} + +// NewGlobalOrgsMetaWithDefaults instantiates a new GlobalOrgsMeta 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 NewGlobalOrgsMetaWithDefaults() *GlobalOrgsMeta { + this := GlobalOrgsMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *GlobalOrgsMeta) GetPage() GlobalOrgsMetaPage { + if o == nil || o.Page == nil { + var ret GlobalOrgsMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsMeta) GetPageOk() (*GlobalOrgsMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *GlobalOrgsMeta) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given GlobalOrgsMetaPage and assigns it to the Page field. +func (o *GlobalOrgsMeta) SetPage(v GlobalOrgsMetaPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgsMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrgsMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Page *GlobalOrgsMetaPage `json:"page,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{"page"}) + } else { + return err + } + + hasInvalidField := false + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_global_orgs_meta_page.go b/api/datadogV2/model_global_orgs_meta_page.go new file mode 100644 index 00000000000..2ffe7366c18 --- /dev/null +++ b/api/datadogV2/model_global_orgs_meta_page.go @@ -0,0 +1,274 @@ +// 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" +) + +// GlobalOrgsMetaPage Paging attributes. +type GlobalOrgsMetaPage struct { + // The cursor used to get the current results, if any. + Cursor *string `json:"cursor,omitempty"` + // Number of results returned. + Limit *int32 `json:"limit,omitempty"` + // The cursor used to get the next results, if any. + NextCursor datadog.NullableString `json:"next_cursor,omitempty"` + // The cursor used to get the previous results, if any. + PrevCursor datadog.NullableString `json:"prev_cursor,omitempty"` + // Type of global orgs pagination. + Type *GlobalOrgsMetaPageType `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGlobalOrgsMetaPage instantiates a new GlobalOrgsMetaPage 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 NewGlobalOrgsMetaPage() *GlobalOrgsMetaPage { + this := GlobalOrgsMetaPage{} + return &this +} + +// NewGlobalOrgsMetaPageWithDefaults instantiates a new GlobalOrgsMetaPage 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 NewGlobalOrgsMetaPageWithDefaults() *GlobalOrgsMetaPage { + this := GlobalOrgsMetaPage{} + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *GlobalOrgsMetaPage) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsMetaPage) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *GlobalOrgsMetaPage) HasCursor() bool { + return o != nil && o.Cursor != nil +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *GlobalOrgsMetaPage) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *GlobalOrgsMetaPage) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsMetaPage) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *GlobalOrgsMetaPage) HasLimit() bool { + return o != nil && o.Limit != nil +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *GlobalOrgsMetaPage) SetLimit(v int32) { + o.Limit = &v +} + +// GetNextCursor returns the NextCursor field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrgsMetaPage) GetNextCursor() string { + if o == nil || o.NextCursor.Get() == nil { + var ret string + return ret + } + return *o.NextCursor.Get() +} + +// GetNextCursorOk returns a tuple with the NextCursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrgsMetaPage) GetNextCursorOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NextCursor.Get(), o.NextCursor.IsSet() +} + +// HasNextCursor returns a boolean if a field has been set. +func (o *GlobalOrgsMetaPage) HasNextCursor() bool { + return o != nil && o.NextCursor.IsSet() +} + +// SetNextCursor gets a reference to the given datadog.NullableString and assigns it to the NextCursor field. +func (o *GlobalOrgsMetaPage) SetNextCursor(v string) { + o.NextCursor.Set(&v) +} + +// SetNextCursorNil sets the value for NextCursor to be an explicit nil. +func (o *GlobalOrgsMetaPage) SetNextCursorNil() { + o.NextCursor.Set(nil) +} + +// UnsetNextCursor ensures that no value is present for NextCursor, not even an explicit nil. +func (o *GlobalOrgsMetaPage) UnsetNextCursor() { + o.NextCursor.Unset() +} + +// GetPrevCursor returns the PrevCursor field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GlobalOrgsMetaPage) GetPrevCursor() string { + if o == nil || o.PrevCursor.Get() == nil { + var ret string + return ret + } + return *o.PrevCursor.Get() +} + +// GetPrevCursorOk returns a tuple with the PrevCursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *GlobalOrgsMetaPage) GetPrevCursorOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PrevCursor.Get(), o.PrevCursor.IsSet() +} + +// HasPrevCursor returns a boolean if a field has been set. +func (o *GlobalOrgsMetaPage) HasPrevCursor() bool { + return o != nil && o.PrevCursor.IsSet() +} + +// SetPrevCursor gets a reference to the given datadog.NullableString and assigns it to the PrevCursor field. +func (o *GlobalOrgsMetaPage) SetPrevCursor(v string) { + o.PrevCursor.Set(&v) +} + +// SetPrevCursorNil sets the value for PrevCursor to be an explicit nil. +func (o *GlobalOrgsMetaPage) SetPrevCursorNil() { + o.PrevCursor.Set(nil) +} + +// UnsetPrevCursor ensures that no value is present for PrevCursor, not even an explicit nil. +func (o *GlobalOrgsMetaPage) UnsetPrevCursor() { + o.PrevCursor.Unset() +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GlobalOrgsMetaPage) GetType() GlobalOrgsMetaPageType { + if o == nil || o.Type == nil { + var ret GlobalOrgsMetaPageType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsMetaPage) GetTypeOk() (*GlobalOrgsMetaPageType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *GlobalOrgsMetaPage) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given GlobalOrgsMetaPageType and assigns it to the Type field. +func (o *GlobalOrgsMetaPage) SetType(v GlobalOrgsMetaPageType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgsMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.NextCursor.IsSet() { + toSerialize["next_cursor"] = o.NextCursor.Get() + } + if o.PrevCursor.IsSet() { + toSerialize["prev_cursor"] = o.PrevCursor.Get() + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrgsMetaPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + NextCursor datadog.NullableString `json:"next_cursor,omitempty"` + PrevCursor datadog.NullableString `json:"prev_cursor,omitempty"` + Type *GlobalOrgsMetaPageType `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cursor", "limit", "next_cursor", "prev_cursor", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Cursor = all.Cursor + o.Limit = all.Limit + o.NextCursor = all.NextCursor + o.PrevCursor = all.PrevCursor + if all.Type != nil && !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_global_orgs_meta_page_type.go b/api/datadogV2/model_global_orgs_meta_page_type.go new file mode 100644 index 00000000000..e626407001a --- /dev/null +++ b/api/datadogV2/model_global_orgs_meta_page_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" +) + +// GlobalOrgsMetaPageType Type of global orgs pagination. +type GlobalOrgsMetaPageType string + +// List of GlobalOrgsMetaPageType. +const ( + GLOBALORGSMETAPAGETYPE_CURSOR GlobalOrgsMetaPageType = "cursor" +) + +var allowedGlobalOrgsMetaPageTypeEnumValues = []GlobalOrgsMetaPageType{ + GLOBALORGSMETAPAGETYPE_CURSOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GlobalOrgsMetaPageType) GetAllowedValues() []GlobalOrgsMetaPageType { + return allowedGlobalOrgsMetaPageTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GlobalOrgsMetaPageType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GlobalOrgsMetaPageType(value) + return nil +} + +// NewGlobalOrgsMetaPageTypeFromValue returns a pointer to a valid GlobalOrgsMetaPageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGlobalOrgsMetaPageTypeFromValue(v string) (*GlobalOrgsMetaPageType, error) { + ev := GlobalOrgsMetaPageType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GlobalOrgsMetaPageType: valid values are %v", v, allowedGlobalOrgsMetaPageTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GlobalOrgsMetaPageType) IsValid() bool { + for _, existing := range allowedGlobalOrgsMetaPageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GlobalOrgsMetaPageType value. +func (v GlobalOrgsMetaPageType) Ptr() *GlobalOrgsMetaPageType { + return &v +} diff --git a/api/datadogV2/model_global_orgs_response.go b/api/datadogV2/model_global_orgs_response.go new file mode 100644 index 00000000000..a9153d98673 --- /dev/null +++ b/api/datadogV2/model_global_orgs_response.go @@ -0,0 +1,183 @@ +// 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" +) + +// GlobalOrgsResponse Response containing organizations across regions for the authenticated user. +type GlobalOrgsResponse struct { + // Organizations across regions for the authenticated user. + Data []GlobalOrgData `json:"data"` + // Pagination links. + Links *GlobalOrgsLinks `json:"links,omitempty"` + // Response metadata object. + Meta *GlobalOrgsMeta `json:"meta,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:"-"` +} + +// NewGlobalOrgsResponse instantiates a new GlobalOrgsResponse 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 NewGlobalOrgsResponse(data []GlobalOrgData) *GlobalOrgsResponse { + this := GlobalOrgsResponse{} + this.Data = data + return &this +} + +// NewGlobalOrgsResponseWithDefaults instantiates a new GlobalOrgsResponse 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 NewGlobalOrgsResponseWithDefaults() *GlobalOrgsResponse { + this := GlobalOrgsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *GlobalOrgsResponse) GetData() []GlobalOrgData { + if o == nil { + var ret []GlobalOrgData + 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 *GlobalOrgsResponse) GetDataOk() (*[]GlobalOrgData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *GlobalOrgsResponse) SetData(v []GlobalOrgData) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *GlobalOrgsResponse) GetLinks() GlobalOrgsLinks { + if o == nil || o.Links == nil { + var ret GlobalOrgsLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsResponse) GetLinksOk() (*GlobalOrgsLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *GlobalOrgsResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given GlobalOrgsLinks and assigns it to the Links field. +func (o *GlobalOrgsResponse) SetLinks(v GlobalOrgsLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *GlobalOrgsResponse) GetMeta() GlobalOrgsMeta { + if o == nil || o.Meta == nil { + var ret GlobalOrgsMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalOrgsResponse) GetMetaOk() (*GlobalOrgsMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *GlobalOrgsResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given GlobalOrgsMeta and assigns it to the Meta field. +func (o *GlobalOrgsResponse) SetMeta(v GlobalOrgsMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GlobalOrgsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GlobalOrgsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]GlobalOrgData `json:"data"` + Links *GlobalOrgsLinks `json:"links,omitempty"` + Meta *GlobalOrgsMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "links", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = *all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/examples/v2/organizations/ListGlobalOrgs.go b/examples/v2/organizations/ListGlobalOrgs.go new file mode 100644 index 00000000000..f98a4d7820c --- /dev/null +++ b/examples/v2/organizations/ListGlobalOrgs.go @@ -0,0 +1,29 @@ +// List global orgs 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.NewOrganizationsApi(apiClient) + resp, r, err := api.ListGlobalOrgs(ctx, "user@example.com", *datadogV2.NewListGlobalOrgsOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.ListGlobalOrgs`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OrganizationsApi.ListGlobalOrgs`:\n%s\n", responseContent) +} diff --git a/examples/v2/organizations/ListGlobalOrgs_465966063.go b/examples/v2/organizations/ListGlobalOrgs_465966063.go new file mode 100644 index 00000000000..9b87b9f7da4 --- /dev/null +++ b/examples/v2/organizations/ListGlobalOrgs_465966063.go @@ -0,0 +1,29 @@ +// List global orgs returns "OK" response with pagination + +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.NewOrganizationsApi(apiClient) + resp, _ := api.ListGlobalOrgsWithPagination(ctx, "user@example.com", *datadogV2.NewListGlobalOrgsOptionalParameters()) + + for paginationResult := range resp { + if paginationResult.Error != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.ListGlobalOrgs`: %v\n", paginationResult.Error) + } + responseContent, _ := json.MarshalIndent(paginationResult.Item, "", " ") + fmt.Fprintf(os.Stdout, "%s\n", responseContent) + } +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index e6778798bbc..31e97222bad 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -95,6 +95,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "EventsApi": reflect.ValueOf(datadogV2.NewEventsApi), "FeatureFlagsApi": reflect.ValueOf(datadogV2.NewFeatureFlagsApi), "FormsApi": reflect.ValueOf(datadogV2.NewFormsApi), + "OrganizationsApi": reflect.ValueOf(datadogV2.NewOrganizationsApi), "HighAvailabilityMultiRegionApi": reflect.ValueOf(datadogV2.NewHighAvailabilityMultiRegionApi), "EntityIntegrationConfigsApi": reflect.ValueOf(datadogV2.NewEntityIntegrationConfigsApi), "IncidentsApi": reflect.ValueOf(datadogV2.NewIncidentsApi), @@ -132,7 +133,6 @@ var apiMappings = map[string]map[string]reflect.Value{ "ObservabilityPipelinesApi": reflect.ValueOf(datadogV2.NewObservabilityPipelinesApi), "OnCallApi": reflect.ValueOf(datadogV2.NewOnCallApi), "OnCallPagingApi": reflect.ValueOf(datadogV2.NewOnCallPagingApi), - "OrganizationsApi": reflect.ValueOf(datadogV2.NewOrganizationsApi), "CustomerOrgApi": reflect.ValueOf(datadogV2.NewCustomerOrgApi), "OrgConnectionsApi": reflect.ValueOf(datadogV2.NewOrgConnectionsApi), "OrgGroupsApi": reflect.ValueOf(datadogV2.NewOrgGroupsApi), diff --git a/tests/scenarios/features/v2/organizations.feature b/tests/scenarios/features/v2/organizations.feature index 01706fd5585..217e7bd2e25 100644 --- a/tests/scenarios/features/v2/organizations.feature +++ b/tests/scenarios/features/v2/organizations.feature @@ -61,6 +61,27 @@ Feature: Organizations When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/delegated-auth-login + Scenario: List global orgs returns "Bad Request" response + Given new "ListGlobalOrgs" request + And request contains "user_handle" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: List global orgs returns "OK" response + Given new "ListGlobalOrgs" request + And request contains "user_handle" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/delegated-auth-login @with-pagination + Scenario: List global orgs returns "OK" response with pagination + Given new "ListGlobalOrgs" request + And request contains "user_handle" parameter from "REPLACE.ME" + When the request with pagination is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/org-management Scenario: List your managed organizations returns "OK" response Given new "ListOrgs" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index d32b680345c..7b182ad052f 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2756,6 +2756,12 @@ "type": "idempotent" } }, + "ListGlobalOrgs": { + "tag": "Organizations", + "undo": { + "type": "safe" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": { From 758965f14c8b3f6ee519cb0c6a855e9faf769091 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:39:17 +0000 Subject: [PATCH 3/5] Regenerate client from commit 9a06a25 of spec repo (#4233) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 45 +++ ...vability_pipeline_config_processor_item.go | 32 ++ ..._pipeline_generate_metrics_v2_processor.go | 286 ++++++++++++++++++ ...line_generate_metrics_v2_processor_type.go | 64 ++++ 4 files changed, 427 insertions(+) create mode 100644 api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor.go create mode 100644 api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor_type.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ad7921d9bc3..5c3583f640a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -61211,6 +61211,7 @@ components: - $ref: "#/components/schemas/ObservabilityPipelineDedupeProcessor" - $ref: "#/components/schemas/ObservabilityPipelineEnrichmentTableProcessor" - $ref: "#/components/schemas/ObservabilityPipelineGenerateMetricsProcessor" + - $ref: "#/components/schemas/ObservabilityPipelineGenerateMetricsV2Processor" - $ref: "#/components/schemas/ObservabilityPipelineOcsfMapperProcessor" - $ref: "#/components/schemas/ObservabilityPipelineParseGrokProcessor" - $ref: "#/components/schemas/ObservabilityPipelineParseJSONProcessor" @@ -62350,6 +62351,50 @@ components: type: string x-enum-varnames: - GENERATE_DATADOG_METRICS + ObservabilityPipelineGenerateMetricsV2Processor: + description: |- + The `generate_metrics` processor creates custom metrics from logs. + Metrics can be counters, gauges, or distributions and optionally grouped by log fields. + The generated metrics must be routed to a metrics destination using the input `.metrics`. + + **Supported pipeline types:** logs + properties: + display_name: + $ref: "#/components/schemas/ObservabilityPipelineComponentDisplayName" + enabled: + description: Indicates whether the processor is enabled. + example: true + type: boolean + id: + description: The unique identifier for this component. Used to reference this component in other parts of the pipeline. + example: generate-metrics-processor + type: string + include: + description: A Datadog search query used to determine which logs this processor targets. + example: "service:my-service" + type: string + metrics: + description: Configuration for generating individual metrics. + items: + $ref: "#/components/schemas/ObservabilityPipelineGeneratedMetric" + type: array + type: + $ref: "#/components/schemas/ObservabilityPipelineGenerateMetricsV2ProcessorType" + required: + - id + - type + - enabled + type: object + x-pipeline-types: [logs] + ObservabilityPipelineGenerateMetricsV2ProcessorType: + default: generate_metrics + description: The processor type. Always `generate_metrics`. + enum: + - generate_metrics + example: generate_metrics + type: string + x-enum-varnames: + - GENERATE_METRICS ObservabilityPipelineGeneratedMetric: description: |- Defines a log-based custom metric, including its name, type, filter, value computation strategy, diff --git a/api/datadogV2/model_observability_pipeline_config_processor_item.go b/api/datadogV2/model_observability_pipeline_config_processor_item.go index 86a0be5f632..6ecb5555bf7 100644 --- a/api/datadogV2/model_observability_pipeline_config_processor_item.go +++ b/api/datadogV2/model_observability_pipeline_config_processor_item.go @@ -19,6 +19,7 @@ type ObservabilityPipelineConfigProcessorItem struct { ObservabilityPipelineDedupeProcessor *ObservabilityPipelineDedupeProcessor ObservabilityPipelineEnrichmentTableProcessor *ObservabilityPipelineEnrichmentTableProcessor ObservabilityPipelineGenerateMetricsProcessor *ObservabilityPipelineGenerateMetricsProcessor + ObservabilityPipelineGenerateMetricsV2Processor *ObservabilityPipelineGenerateMetricsV2Processor ObservabilityPipelineOcsfMapperProcessor *ObservabilityPipelineOcsfMapperProcessor ObservabilityPipelineParseGrokProcessor *ObservabilityPipelineParseGrokProcessor ObservabilityPipelineParseJSONProcessor *ObservabilityPipelineParseJSONProcessor @@ -86,6 +87,11 @@ func ObservabilityPipelineGenerateMetricsProcessorAsObservabilityPipelineConfigP return ObservabilityPipelineConfigProcessorItem{ObservabilityPipelineGenerateMetricsProcessor: v} } +// ObservabilityPipelineGenerateMetricsV2ProcessorAsObservabilityPipelineConfigProcessorItem is a convenience function that returns ObservabilityPipelineGenerateMetricsV2Processor wrapped in ObservabilityPipelineConfigProcessorItem. +func ObservabilityPipelineGenerateMetricsV2ProcessorAsObservabilityPipelineConfigProcessorItem(v *ObservabilityPipelineGenerateMetricsV2Processor) ObservabilityPipelineConfigProcessorItem { + return ObservabilityPipelineConfigProcessorItem{ObservabilityPipelineGenerateMetricsV2Processor: v} +} + // ObservabilityPipelineOcsfMapperProcessorAsObservabilityPipelineConfigProcessorItem is a convenience function that returns ObservabilityPipelineOcsfMapperProcessor wrapped in ObservabilityPipelineConfigProcessorItem. func ObservabilityPipelineOcsfMapperProcessorAsObservabilityPipelineConfigProcessorItem(v *ObservabilityPipelineOcsfMapperProcessor) ObservabilityPipelineConfigProcessorItem { return ObservabilityPipelineConfigProcessorItem{ObservabilityPipelineOcsfMapperProcessor: v} @@ -328,6 +334,23 @@ func (obj *ObservabilityPipelineConfigProcessorItem) UnmarshalJSON(data []byte) obj.ObservabilityPipelineGenerateMetricsProcessor = nil } + // try to unmarshal data into ObservabilityPipelineGenerateMetricsV2Processor + err = datadog.Unmarshal(data, &obj.ObservabilityPipelineGenerateMetricsV2Processor) + if err == nil { + if obj.ObservabilityPipelineGenerateMetricsV2Processor != nil && obj.ObservabilityPipelineGenerateMetricsV2Processor.UnparsedObject == nil { + jsonObservabilityPipelineGenerateMetricsV2Processor, _ := datadog.Marshal(obj.ObservabilityPipelineGenerateMetricsV2Processor) + if string(jsonObservabilityPipelineGenerateMetricsV2Processor) == "{}" { // empty struct + obj.ObservabilityPipelineGenerateMetricsV2Processor = nil + } else { + match++ + } + } else { + obj.ObservabilityPipelineGenerateMetricsV2Processor = nil + } + } else { + obj.ObservabilityPipelineGenerateMetricsV2Processor = nil + } + // try to unmarshal data into ObservabilityPipelineOcsfMapperProcessor err = datadog.Unmarshal(data, &obj.ObservabilityPipelineOcsfMapperProcessor) if err == nil { @@ -628,6 +651,7 @@ func (obj *ObservabilityPipelineConfigProcessorItem) UnmarshalJSON(data []byte) obj.ObservabilityPipelineDedupeProcessor = nil obj.ObservabilityPipelineEnrichmentTableProcessor = nil obj.ObservabilityPipelineGenerateMetricsProcessor = nil + obj.ObservabilityPipelineGenerateMetricsV2Processor = nil obj.ObservabilityPipelineOcsfMapperProcessor = nil obj.ObservabilityPipelineParseGrokProcessor = nil obj.ObservabilityPipelineParseJSONProcessor = nil @@ -688,6 +712,10 @@ func (obj ObservabilityPipelineConfigProcessorItem) MarshalJSON() ([]byte, error return datadog.Marshal(&obj.ObservabilityPipelineGenerateMetricsProcessor) } + if obj.ObservabilityPipelineGenerateMetricsV2Processor != nil { + return datadog.Marshal(&obj.ObservabilityPipelineGenerateMetricsV2Processor) + } + if obj.ObservabilityPipelineOcsfMapperProcessor != nil { return datadog.Marshal(&obj.ObservabilityPipelineOcsfMapperProcessor) } @@ -800,6 +828,10 @@ func (obj *ObservabilityPipelineConfigProcessorItem) GetActualInstance() interfa return obj.ObservabilityPipelineGenerateMetricsProcessor } + if obj.ObservabilityPipelineGenerateMetricsV2Processor != nil { + return obj.ObservabilityPipelineGenerateMetricsV2Processor + } + if obj.ObservabilityPipelineOcsfMapperProcessor != nil { return obj.ObservabilityPipelineOcsfMapperProcessor } diff --git a/api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor.go b/api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor.go new file mode 100644 index 00000000000..f1848bd5a8a --- /dev/null +++ b/api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor.go @@ -0,0 +1,286 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ObservabilityPipelineGenerateMetricsV2Processor The `generate_metrics` processor creates custom metrics from logs. +// Metrics can be counters, gauges, or distributions and optionally grouped by log fields. +// The generated metrics must be routed to a metrics destination using the input `.metrics`. +// +// **Supported pipeline types:** logs +type ObservabilityPipelineGenerateMetricsV2Processor struct { + // The display name for a component. + DisplayName *string `json:"display_name,omitempty"` + // Indicates whether the processor is enabled. + Enabled bool `json:"enabled"` + // The unique identifier for this component. Used to reference this component in other parts of the pipeline. + Id string `json:"id"` + // A Datadog search query used to determine which logs this processor targets. + Include *string `json:"include,omitempty"` + // Configuration for generating individual metrics. + Metrics []ObservabilityPipelineGeneratedMetric `json:"metrics,omitempty"` + // The processor type. Always `generate_metrics`. + Type ObservabilityPipelineGenerateMetricsV2ProcessorType `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:"-"` +} + +// NewObservabilityPipelineGenerateMetricsV2Processor instantiates a new ObservabilityPipelineGenerateMetricsV2Processor 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 NewObservabilityPipelineGenerateMetricsV2Processor(enabled bool, id string, typeVar ObservabilityPipelineGenerateMetricsV2ProcessorType) *ObservabilityPipelineGenerateMetricsV2Processor { + this := ObservabilityPipelineGenerateMetricsV2Processor{} + this.Enabled = enabled + this.Id = id + this.Type = typeVar + return &this +} + +// NewObservabilityPipelineGenerateMetricsV2ProcessorWithDefaults instantiates a new ObservabilityPipelineGenerateMetricsV2Processor 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 NewObservabilityPipelineGenerateMetricsV2ProcessorWithDefaults() *ObservabilityPipelineGenerateMetricsV2Processor { + this := ObservabilityPipelineGenerateMetricsV2Processor{} + var typeVar ObservabilityPipelineGenerateMetricsV2ProcessorType = OBSERVABILITYPIPELINEGENERATEMETRICSV2PROCESSORTYPE_GENERATE_METRICS + this.Type = typeVar + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetDisplayName() string { + if o == nil || o.DisplayName == nil { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetDisplayNameOk() (*string, bool) { + if o == nil || o.DisplayName == nil { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) HasDisplayName() bool { + return o != nil && o.DisplayName != nil +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetEnabled returns the Enabled field value. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) SetEnabled(v bool) { + o.Enabled = v +} + +// GetId returns the Id field value. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) 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 *ObservabilityPipelineGenerateMetricsV2Processor) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) SetId(v string) { + o.Id = v +} + +// GetInclude returns the Include field value if set, zero value otherwise. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetInclude() string { + if o == nil || o.Include == nil { + var ret string + return ret + } + return *o.Include +} + +// GetIncludeOk returns a tuple with the Include field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetIncludeOk() (*string, bool) { + if o == nil || o.Include == nil { + return nil, false + } + return o.Include, true +} + +// HasInclude returns a boolean if a field has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) HasInclude() bool { + return o != nil && o.Include != nil +} + +// SetInclude gets a reference to the given string and assigns it to the Include field. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) SetInclude(v string) { + o.Include = &v +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetMetrics() []ObservabilityPipelineGeneratedMetric { + if o == nil || o.Metrics == nil { + var ret []ObservabilityPipelineGeneratedMetric + return ret + } + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetMetricsOk() (*[]ObservabilityPipelineGeneratedMetric, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return &o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) HasMetrics() bool { + return o != nil && o.Metrics != nil +} + +// SetMetrics gets a reference to the given []ObservabilityPipelineGeneratedMetric and assigns it to the Metrics field. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) SetMetrics(v []ObservabilityPipelineGeneratedMetric) { + o.Metrics = v +} + +// GetType returns the Type field value. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) GetType() ObservabilityPipelineGenerateMetricsV2ProcessorType { + if o == nil { + var ret ObservabilityPipelineGenerateMetricsV2ProcessorType + 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 *ObservabilityPipelineGenerateMetricsV2Processor) GetTypeOk() (*ObservabilityPipelineGenerateMetricsV2ProcessorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) SetType(v ObservabilityPipelineGenerateMetricsV2ProcessorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ObservabilityPipelineGenerateMetricsV2Processor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DisplayName != nil { + toSerialize["display_name"] = o.DisplayName + } + toSerialize["enabled"] = o.Enabled + toSerialize["id"] = o.Id + if o.Include != nil { + toSerialize["include"] = o.Include + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ObservabilityPipelineGenerateMetricsV2Processor) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DisplayName *string `json:"display_name,omitempty"` + Enabled *bool `json:"enabled"` + Id *string `json:"id"` + Include *string `json:"include,omitempty"` + Metrics []ObservabilityPipelineGeneratedMetric `json:"metrics,omitempty"` + Type *ObservabilityPipelineGenerateMetricsV2ProcessorType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Enabled == nil { + return fmt.Errorf("required field enabled 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{"display_name", "enabled", "id", "include", "metrics", "type"}) + } else { + return err + } + + hasInvalidField := false + o.DisplayName = all.DisplayName + o.Enabled = *all.Enabled + o.Id = *all.Id + o.Include = all.Include + o.Metrics = all.Metrics + 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_observability_pipeline_generate_metrics_v2_processor_type.go b/api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor_type.go new file mode 100644 index 00000000000..f89084d169d --- /dev/null +++ b/api/datadogV2/model_observability_pipeline_generate_metrics_v2_processor_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" +) + +// ObservabilityPipelineGenerateMetricsV2ProcessorType The processor type. Always `generate_metrics`. +type ObservabilityPipelineGenerateMetricsV2ProcessorType string + +// List of ObservabilityPipelineGenerateMetricsV2ProcessorType. +const ( + OBSERVABILITYPIPELINEGENERATEMETRICSV2PROCESSORTYPE_GENERATE_METRICS ObservabilityPipelineGenerateMetricsV2ProcessorType = "generate_metrics" +) + +var allowedObservabilityPipelineGenerateMetricsV2ProcessorTypeEnumValues = []ObservabilityPipelineGenerateMetricsV2ProcessorType{ + OBSERVABILITYPIPELINEGENERATEMETRICSV2PROCESSORTYPE_GENERATE_METRICS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ObservabilityPipelineGenerateMetricsV2ProcessorType) GetAllowedValues() []ObservabilityPipelineGenerateMetricsV2ProcessorType { + return allowedObservabilityPipelineGenerateMetricsV2ProcessorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ObservabilityPipelineGenerateMetricsV2ProcessorType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ObservabilityPipelineGenerateMetricsV2ProcessorType(value) + return nil +} + +// NewObservabilityPipelineGenerateMetricsV2ProcessorTypeFromValue returns a pointer to a valid ObservabilityPipelineGenerateMetricsV2ProcessorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewObservabilityPipelineGenerateMetricsV2ProcessorTypeFromValue(v string) (*ObservabilityPipelineGenerateMetricsV2ProcessorType, error) { + ev := ObservabilityPipelineGenerateMetricsV2ProcessorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ObservabilityPipelineGenerateMetricsV2ProcessorType: valid values are %v", v, allowedObservabilityPipelineGenerateMetricsV2ProcessorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ObservabilityPipelineGenerateMetricsV2ProcessorType) IsValid() bool { + for _, existing := range allowedObservabilityPipelineGenerateMetricsV2ProcessorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ObservabilityPipelineGenerateMetricsV2ProcessorType value. +func (v ObservabilityPipelineGenerateMetricsV2ProcessorType) Ptr() *ObservabilityPipelineGenerateMetricsV2ProcessorType { + return &v +} From be9bd33e4b1e3f36d74e6ba17bad7e8dd381c24d Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 23:27:28 +0000 Subject: [PATCH 4/5] Regenerate client from commit 81b4470 of spec repo (#4236) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 75 +++++++++ api/datadogV2/api_organizations.go | 71 +++++++++ api/datadogV2/doc.go | 1 + .../model_max_session_duration_type.go | 64 ++++++++ ..._max_session_duration_update_attributes.go | 101 ++++++++++++ .../model_max_session_duration_update_data.go | 146 ++++++++++++++++++ ...del_max_session_duration_update_request.go | 110 +++++++++++++ ...UpdateLoginOrgConfigsMaxSessionDuration.go | 33 ++++ .../features/v2/organizations.feature | 14 ++ tests/scenarios/features/v2/undo.json | 6 + 10 files changed, 621 insertions(+) create mode 100644 api/datadogV2/model_max_session_duration_type.go create mode 100644 api/datadogV2/model_max_session_duration_update_attributes.go create mode 100644 api/datadogV2/model_max_session_duration_update_data.go create mode 100644 api/datadogV2/model_max_session_duration_update_request.go create mode 100644 examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5c3583f640a..3c5f7289ed3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -55468,6 +55468,40 @@ components: type: string x-enum-varnames: - MANAGED_ORGS + MaxSessionDurationType: + description: Data type of a maximum session duration update. + enum: [max_session_duration] + example: max_session_duration + type: string + x-enum-varnames: + - MAX_SESSION_DURATION + MaxSessionDurationUpdateAttributes: + description: Attributes for the maximum session duration update request. + properties: + max_session_duration: + description: The maximum session duration, in seconds. + example: 604800 + format: int64 + minimum: 1 + type: integer + required: [max_session_duration] + type: object + MaxSessionDurationUpdateData: + description: The data object for a maximum session duration update request. + properties: + attributes: + $ref: "#/components/schemas/MaxSessionDurationUpdateAttributes" + type: + $ref: "#/components/schemas/MaxSessionDurationType" + required: [type, attributes] + type: object + MaxSessionDurationUpdateRequest: + description: A request to update the maximum session duration for an organization. + properties: + data: + $ref: "#/components/schemas/MaxSessionDurationUpdateData" + required: [data] + type: object McpScanRequest: description: The top-level request object for submitting an MCP SCA dependency scan. properties: @@ -143303,6 +143337,47 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/login/org_configs/max_session_duration: + put: + description: |- + Update the maximum session duration for the current organization. + The duration is specified in seconds. + operationId: UpdateLoginOrgConfigsMaxSessionDuration + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + max_session_duration: 604800 + type: max_session_duration + schema: + $ref: "#/components/schemas/MaxSessionDurationUpdateRequest" + required: true + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Update the maximum session duration + tags: [Organizations] + "x-permission": + operator: OR + permissions: + - org_management /api/v2/logs: post: description: |- diff --git a/api/datadogV2/api_organizations.go b/api/datadogV2/api_organizations.go index fdb365ceac4..d9c9e63eeab 100644 --- a/api/datadogV2/api_organizations.go +++ b/api/datadogV2/api_organizations.go @@ -607,6 +607,77 @@ func (a *OrganizationsApi) ListSAMLConfigurations(ctx _context.Context) (SAMLCon return localVarReturnValue, localVarHTTPResponse, nil } +// UpdateLoginOrgConfigsMaxSessionDuration Update the maximum session duration. +// Update the maximum session duration for the current organization. +// The duration is specified in seconds. +func (a *OrganizationsApi) UpdateLoginOrgConfigsMaxSessionDuration(ctx _context.Context, body MaxSessionDurationUpdateRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OrganizationsApi.UpdateLoginOrgConfigsMaxSessionDuration") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/login/org_configs/max_session_duration" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 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 +} + // UpdateOrgConfig Update a specific Org Config. // Update the value of a specific Org Config. func (a *OrganizationsApi) UpdateOrgConfig(ctx _context.Context, orgConfigName string, body OrgConfigWriteRequest) (OrgConfigGetResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 54e91afe438..2175d5a2c20 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -820,6 +820,7 @@ // - [OrganizationsApi.ListOrgConfigs] // - [OrganizationsApi.ListOrgs] // - [OrganizationsApi.ListSAMLConfigurations] +// - [OrganizationsApi.UpdateLoginOrgConfigsMaxSessionDuration] // - [OrganizationsApi.UpdateOrgConfig] // - [OrganizationsApi.UpdateOrgSamlConfigurations] // - [OrganizationsApi.UpdateSAMLConfiguration] diff --git a/api/datadogV2/model_max_session_duration_type.go b/api/datadogV2/model_max_session_duration_type.go new file mode 100644 index 00000000000..109530fae2f --- /dev/null +++ b/api/datadogV2/model_max_session_duration_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" +) + +// MaxSessionDurationType Data type of a maximum session duration update. +type MaxSessionDurationType string + +// List of MaxSessionDurationType. +const ( + MAXSESSIONDURATIONTYPE_MAX_SESSION_DURATION MaxSessionDurationType = "max_session_duration" +) + +var allowedMaxSessionDurationTypeEnumValues = []MaxSessionDurationType{ + MAXSESSIONDURATIONTYPE_MAX_SESSION_DURATION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MaxSessionDurationType) GetAllowedValues() []MaxSessionDurationType { + return allowedMaxSessionDurationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MaxSessionDurationType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MaxSessionDurationType(value) + return nil +} + +// NewMaxSessionDurationTypeFromValue returns a pointer to a valid MaxSessionDurationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMaxSessionDurationTypeFromValue(v string) (*MaxSessionDurationType, error) { + ev := MaxSessionDurationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MaxSessionDurationType: valid values are %v", v, allowedMaxSessionDurationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MaxSessionDurationType) IsValid() bool { + for _, existing := range allowedMaxSessionDurationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MaxSessionDurationType value. +func (v MaxSessionDurationType) Ptr() *MaxSessionDurationType { + return &v +} diff --git a/api/datadogV2/model_max_session_duration_update_attributes.go b/api/datadogV2/model_max_session_duration_update_attributes.go new file mode 100644 index 00000000000..2d14a1683ea --- /dev/null +++ b/api/datadogV2/model_max_session_duration_update_attributes.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" +) + +// MaxSessionDurationUpdateAttributes Attributes for the maximum session duration update request. +type MaxSessionDurationUpdateAttributes struct { + // The maximum session duration, in seconds. + MaxSessionDuration int64 `json:"max_session_duration"` + // 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:"-"` +} + +// NewMaxSessionDurationUpdateAttributes instantiates a new MaxSessionDurationUpdateAttributes 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 NewMaxSessionDurationUpdateAttributes(maxSessionDuration int64) *MaxSessionDurationUpdateAttributes { + this := MaxSessionDurationUpdateAttributes{} + this.MaxSessionDuration = maxSessionDuration + return &this +} + +// NewMaxSessionDurationUpdateAttributesWithDefaults instantiates a new MaxSessionDurationUpdateAttributes 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 NewMaxSessionDurationUpdateAttributesWithDefaults() *MaxSessionDurationUpdateAttributes { + this := MaxSessionDurationUpdateAttributes{} + return &this +} + +// GetMaxSessionDuration returns the MaxSessionDuration field value. +func (o *MaxSessionDurationUpdateAttributes) GetMaxSessionDuration() int64 { + if o == nil { + var ret int64 + return ret + } + return o.MaxSessionDuration +} + +// GetMaxSessionDurationOk returns a tuple with the MaxSessionDuration field value +// and a boolean to check if the value has been set. +func (o *MaxSessionDurationUpdateAttributes) GetMaxSessionDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.MaxSessionDuration, true +} + +// SetMaxSessionDuration sets field value. +func (o *MaxSessionDurationUpdateAttributes) SetMaxSessionDuration(v int64) { + o.MaxSessionDuration = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MaxSessionDurationUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["max_session_duration"] = o.MaxSessionDuration + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MaxSessionDurationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + MaxSessionDuration *int64 `json:"max_session_duration"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.MaxSessionDuration == nil { + return fmt.Errorf("required field max_session_duration missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"max_session_duration"}) + } else { + return err + } + o.MaxSessionDuration = *all.MaxSessionDuration + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_max_session_duration_update_data.go b/api/datadogV2/model_max_session_duration_update_data.go new file mode 100644 index 00000000000..7fad74d446a --- /dev/null +++ b/api/datadogV2/model_max_session_duration_update_data.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MaxSessionDurationUpdateData The data object for a maximum session duration update request. +type MaxSessionDurationUpdateData struct { + // Attributes for the maximum session duration update request. + Attributes MaxSessionDurationUpdateAttributes `json:"attributes"` + // Data type of a maximum session duration update. + Type MaxSessionDurationType `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:"-"` +} + +// NewMaxSessionDurationUpdateData instantiates a new MaxSessionDurationUpdateData 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 NewMaxSessionDurationUpdateData(attributes MaxSessionDurationUpdateAttributes, typeVar MaxSessionDurationType) *MaxSessionDurationUpdateData { + this := MaxSessionDurationUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewMaxSessionDurationUpdateDataWithDefaults instantiates a new MaxSessionDurationUpdateData 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 NewMaxSessionDurationUpdateDataWithDefaults() *MaxSessionDurationUpdateData { + this := MaxSessionDurationUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *MaxSessionDurationUpdateData) GetAttributes() MaxSessionDurationUpdateAttributes { + if o == nil { + var ret MaxSessionDurationUpdateAttributes + 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 *MaxSessionDurationUpdateData) GetAttributesOk() (*MaxSessionDurationUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *MaxSessionDurationUpdateData) SetAttributes(v MaxSessionDurationUpdateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *MaxSessionDurationUpdateData) GetType() MaxSessionDurationType { + if o == nil { + var ret MaxSessionDurationType + 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 *MaxSessionDurationUpdateData) GetTypeOk() (*MaxSessionDurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MaxSessionDurationUpdateData) SetType(v MaxSessionDurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MaxSessionDurationUpdateData) 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 *MaxSessionDurationUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MaxSessionDurationUpdateAttributes `json:"attributes"` + Type *MaxSessionDurationType `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_max_session_duration_update_request.go b/api/datadogV2/model_max_session_duration_update_request.go new file mode 100644 index 00000000000..a903392b2c1 --- /dev/null +++ b/api/datadogV2/model_max_session_duration_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" +) + +// MaxSessionDurationUpdateRequest A request to update the maximum session duration for an organization. +type MaxSessionDurationUpdateRequest struct { + // The data object for a maximum session duration update request. + Data MaxSessionDurationUpdateData `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:"-"` +} + +// NewMaxSessionDurationUpdateRequest instantiates a new MaxSessionDurationUpdateRequest 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 NewMaxSessionDurationUpdateRequest(data MaxSessionDurationUpdateData) *MaxSessionDurationUpdateRequest { + this := MaxSessionDurationUpdateRequest{} + this.Data = data + return &this +} + +// NewMaxSessionDurationUpdateRequestWithDefaults instantiates a new MaxSessionDurationUpdateRequest 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 NewMaxSessionDurationUpdateRequestWithDefaults() *MaxSessionDurationUpdateRequest { + this := MaxSessionDurationUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MaxSessionDurationUpdateRequest) GetData() MaxSessionDurationUpdateData { + if o == nil { + var ret MaxSessionDurationUpdateData + 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 *MaxSessionDurationUpdateRequest) GetDataOk() (*MaxSessionDurationUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MaxSessionDurationUpdateRequest) SetData(v MaxSessionDurationUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MaxSessionDurationUpdateRequest) 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 *MaxSessionDurationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *MaxSessionDurationUpdateData `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/examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.go b/examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.go new file mode 100644 index 00000000000..7e59b943af4 --- /dev/null +++ b/examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.go @@ -0,0 +1,33 @@ +// Update the maximum session duration returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.MaxSessionDurationUpdateRequest{ + Data: datadogV2.MaxSessionDurationUpdateData{ + Attributes: datadogV2.MaxSessionDurationUpdateAttributes{ + MaxSessionDuration: 604800, + }, + Type: datadogV2.MAXSESSIONDURATIONTYPE_MAX_SESSION_DURATION, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOrganizationsApi(apiClient) + r, err := api.UpdateLoginOrgConfigsMaxSessionDuration(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.UpdateLoginOrgConfigsMaxSessionDuration`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/features/v2/organizations.feature b/tests/scenarios/features/v2/organizations.feature index 217e7bd2e25..a8ed63ab7e6 100644 --- a/tests/scenarios/features/v2/organizations.feature +++ b/tests/scenarios/features/v2/organizations.feature @@ -168,6 +168,20 @@ Feature: Organizations When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Update the maximum session duration returns "Bad Request" response + Given new "UpdateLoginOrgConfigsMaxSessionDuration" request + And body with value {"data": {"attributes": {"max_session_duration": 604800}, "type": "max_session_duration"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Update the maximum session duration returns "No Content" response + Given new "UpdateLoginOrgConfigsMaxSessionDuration" request + And body with value {"data": {"attributes": {"max_session_duration": 604800}, "type": "max_session_duration"}} + When the request is sent + Then the response status is 204 No Content + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/delegated-auth-login Scenario: Upload IdP metadata returns "Bad Request - caused by either malformed XML or invalid SAML IdP metadata" response Given new "UploadIdPMetadata" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 7b182ad052f..54f20db6460 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4560,6 +4560,12 @@ "type": "safe" } }, + "UpdateLoginOrgConfigsMaxSessionDuration": { + "tag": "Organizations", + "undo": { + "type": "idempotent" + } + }, "SubmitLog": { "tag": "Logs", "undo": { From 77fd00de04a35725d91c0d3e5944d106ff26e840 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Sat, 13 Jun 2026 00:05:59 +0000 Subject: [PATCH 5/5] Regenerate client from commit 7c67677 of spec repo (#4219) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 5 +++++ api/datadogV2/api_cloud_cost_management.go | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3c5f7289ed3..f5b3f392980 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -122198,6 +122198,11 @@ paths: name: filter[provider] schema: type: string + - description: Filter results to tag keys that have data for a specific Cloud Cost Management metric (for example, `aws.cost.net.amortized`). When omitted, all tag keys for the requested period are returned. + in: query + name: filter[metric] + schema: + type: string responses: "200": content: diff --git a/api/datadogV2/api_cloud_cost_management.go b/api/datadogV2/api_cloud_cost_management.go index 08276823fcd..003401ab7c3 100644 --- a/api/datadogV2/api_cloud_cost_management.go +++ b/api/datadogV2/api_cloud_cost_management.go @@ -3811,6 +3811,7 @@ func (a *CloudCostManagementApi) ListCostTagDescriptions(ctx _context.Context, o // ListCostTagKeySourcesOptionalParameters holds optional parameters for ListCostTagKeySources. type ListCostTagKeySourcesOptionalParameters struct { FilterProvider *string + FilterMetric *string } // NewListCostTagKeySourcesOptionalParameters creates an empty struct for parameters. @@ -3825,6 +3826,12 @@ func (r *ListCostTagKeySourcesOptionalParameters) WithFilterProvider(filterProvi return r } +// WithFilterMetric sets the corresponding parameter name and returns the struct. +func (r *ListCostTagKeySourcesOptionalParameters) WithFilterMetric(filterMetric string) *ListCostTagKeySourcesOptionalParameters { + r.FilterMetric = &filterMetric + return r +} + // ListCostTagKeySources List Cloud Cost Management tag sources. // List Cloud Cost Management tag keys observed for the requested period, along with the origin sources that produced them (for example, `aws-user-defined`, `custom`). func (a *CloudCostManagementApi) ListCostTagKeySources(ctx _context.Context, filterMonth string, o ...ListCostTagKeySourcesOptionalParameters) (CostTagKeySourcesResponse, *_nethttp.Response, error) { @@ -3865,6 +3872,9 @@ func (a *CloudCostManagementApi) ListCostTagKeySources(ctx _context.Context, fil if optionalParams.FilterProvider != nil { localVarQueryParams.Add("filter[provider]", datadog.ParameterToString(*optionalParams.FilterProvider, "")) } + if optionalParams.FilterMetric != nil { + localVarQueryParams.Add("filter[metric]", datadog.ParameterToString(*optionalParams.FilterMetric, "")) + } localVarHeaderParams["Accept"] = "application/json" if a.Client.Cfg.DelegatedTokenConfig != nil {