diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2994c0bb30b..30596739d0f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -30990,7 +30990,7 @@ components: properties: org_site: description: The site of the organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization. @@ -51298,7 +51298,7 @@ components: type: string owner_org_site: description: The site of the organization that owns this org group. - example: "datadoghq.com" + example: "us1" type: string owner_org_uuid: description: The UUID of the organization that owns this org group. @@ -51404,7 +51404,7 @@ components: type: string org_site: description: The site of the member organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the member organization. @@ -51625,11 +51625,8 @@ components: example: value: "UTC" type: object - enforced_at: - description: Timestamp when the policy was enforced. - example: "2024-01-15T10:30:00Z" - format: date-time - type: string + enforcement_tier: + $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" modified_at: description: Timestamp when the policy was last modified. example: "2024-01-15T10:30:00Z" @@ -51639,9 +51636,12 @@ components: description: The name of the policy. example: "monitor_timezone" type: string + policy_type: + $ref: "#/components/schemas/OrgGroupPolicyPolicyType" required: - policy_name - - enforced_at + - policy_type + - enforcement_tier - modified_at type: object OrgGroupPolicyConfigAttributes: @@ -51712,7 +51712,8 @@ components: x-enum-varnames: - ORG_GROUP_POLICY_CONFIGS OrgGroupPolicyCreateAttributes: - description: Attributes for creating an org group policy. + description: >- + Attributes for creating an org group policy. If `policy_type` or `enforcement_tier` are not provided, they default to `org_config` and `DEFAULT` respectively. properties: content: additionalProperties: {} @@ -51720,10 +51721,14 @@ components: example: value: "UTC" type: object + enforcement_tier: + $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" policy_name: description: The name of the policy. example: "monitor_timezone" type: string + policy_type: + $ref: "#/components/schemas/OrgGroupPolicyPolicyType" required: - policy_name - content @@ -51777,6 +51782,20 @@ components: - type - attributes type: object + OrgGroupPolicyEnforcementTier: + default: DEFAULT + description: >- + The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + enum: + - DEFAULT + - ENFORCE + - DELEGATE + example: DEFAULT + type: string + x-enum-varnames: + - DEFAULT + - ENFORCE + - DELEGATE OrgGroupPolicyListResponse: description: Response containing a list of org group policies. properties: @@ -51809,7 +51828,7 @@ components: type: string org_site: description: The site of the organization that has the override. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization that has the override. @@ -51827,7 +51846,7 @@ components: properties: org_site: description: The site of the organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization to grant the override. @@ -51943,11 +51962,12 @@ components: x-enum-varnames: - ORG_GROUP_POLICY_OVERRIDES OrgGroupPolicyOverrideUpdateAttributes: - description: Attributes for updating a policy override. + description: >- + Attributes for updating a policy override. The `org_uuid` and `org_site` fields must match the existing override and cannot be changed. properties: org_site: description: The site of the organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization. @@ -51983,6 +52003,16 @@ components: required: - data type: object + OrgGroupPolicyPolicyType: + default: org_config + description: >- + The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + enum: + - org_config + example: org_config + type: string + x-enum-varnames: + - ORG_CONFIG OrgGroupPolicyRelationshipToOne: description: Relationship to a single org group policy. properties: @@ -52051,6 +52081,8 @@ components: example: value: "UTC" type: object + enforcement_tier: + $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" type: object OrgGroupPolicyUpdateData: description: Data for updating an org group policy. @@ -62654,19 +62686,23 @@ components: - DONE - TIMEOUT SecurityMonitoringContentPackActivation: - description: The activation status of a content pack + description: The activation status of a content pack. enum: - never_activated - activated - deactivated example: activated type: string + x-enum-descriptions: + - Pack has never been activated for this organization. + - Pack is currently activated. + - Pack was previously activated but has since been deactivated. x-enum-varnames: - NEVER_ACTIVATED - ACTIVATED - DEACTIVATED SecurityMonitoringContentPackIntegrationStatus: - description: The installation status of the related integration + description: The installation status of the related integration. enum: - installed - available @@ -62675,6 +62711,12 @@ components: - error example: installed type: string + x-enum-descriptions: + - Integration is fully installed. + - Integration exists in the catalog but is not installed. + - Integration is only partially configured. + - Integration detected (for example, logs are flowing) but not explicitly installed. + - Integration is in an error state. x-enum-varnames: - INSTALLED - AVAILABLE @@ -62691,7 +62733,9 @@ components: cp_activation: $ref: "#/components/schemas/SecurityMonitoringContentPackActivation" filters_configured_for_logs: - description: Whether filters (Security Filters or Index Query depending on the pricing model) are configured for logs + description: |- + Whether filters (Security Filters or Index Query depending on the pricing model) are + present and correctly configured to route logs into Cloud SIEM. example: true type: boolean integration_installed_status: @@ -62699,7 +62743,7 @@ components: logs_last_collected: $ref: "#/components/schemas/SecurityMonitoringContentPackTimestampBucket" logs_seen_from_any_index: - description: Whether logs have been seen from any index + description: Whether logs for this content pack have been seen in any Datadog index within the last 72 hours. example: true type: boolean state: @@ -62764,7 +62808,7 @@ components: - meta type: object SecurityMonitoringContentPackStatus: - description: The current status of a content pack + description: The current operational status of a content pack. enum: - install - activate @@ -62774,6 +62818,13 @@ components: - broken example: active type: string + x-enum-descriptions: + - Not activated; no logs detected in the last 72 hours. + - Not activated; logs are flowing into a Datadog index but not yet routed through Cloud SIEM. + - Activated; awaiting first log ingestion. + - Activated; logs received within the last 24 hours. + - Activated; integration not installed or logs last seen 24 to 72 hours ago. + - Activated; no logs for over 72 hours, filter missing, or Cloud SIEM index incorrectly ordered. x-enum-varnames: - INSTALL - ACTIVATE @@ -62782,7 +62833,7 @@ components: - WARNING - BROKEN SecurityMonitoringContentPackTimestampBucket: - description: Timestamp bucket indicating when logs were last collected + description: Timestamp bucket indicating when logs were last collected. enum: - not_seen - within_24_hours @@ -62791,6 +62842,12 @@ components: - over_30d example: within_24_hours type: string + x-enum-descriptions: + - No logs observed. + - Logs received within the last 24 hours. + - Logs last seen 24 to 72 hours ago. + - Logs last seen 3 to 30 days ago. + - Logs last seen more than 30 days ago. x-enum-varnames: - NOT_SEEN - WITHIN_24_HOURS @@ -63881,7 +63938,7 @@ components: - $ref: "#/components/schemas/SecurityMonitoringSignalRulePayload" - $ref: "#/components/schemas/CloudConfigurationRulePayload" SecurityMonitoringSKU: - description: The SIEM pricing model (SKU) for the organization + description: The Cloud SIEM pricing model (SKU) for the organization. enum: - per_gb_analyzed - per_event_in_siem_index_2023 @@ -108264,7 +108321,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -108322,7 +108379,7 @@ paths: data: attributes: orgs: - - org_site: "datadoghq.com" + - org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" relationships: source_org_group: @@ -108349,7 +108406,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -108414,7 +108471,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -108495,7 +108552,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -108563,9 +108620,10 @@ paths: - attributes: content: value: "UTC" - enforced_at: "2024-01-15T10:30:00Z" + enforcement_tier: "DEFAULT" modified_at: "2024-01-15T10:30:00Z" policy_name: "monitor_timezone" + policy_type: "org_config" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" relationships: org_group: @@ -108621,7 +108679,9 @@ paths: attributes: content: value: "UTC" + enforcement_tier: "DEFAULT" policy_name: "monitor_timezone" + policy_type: "org_config" relationships: org_group: data: @@ -108642,9 +108702,10 @@ paths: attributes: content: value: "UTC" - enforced_at: "2024-01-15T10:30:00Z" + enforcement_tier: "DEFAULT" modified_at: "2024-01-15T10:30:00Z" policy_name: "monitor_timezone" + policy_type: "org_config" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" relationships: org_group: @@ -108734,8 +108795,73 @@ 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/). + get: + description: Get a specific organization group policy by its ID. + operationId: GetOrgGroupPolicy + parameters: + - $ref: "#/components/parameters/OrgGroupPolicyId" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + content: + value: "UTC" + enforcement_tier: "DEFAULT" + modified_at: "2024-01-15T10:30:00Z" + policy_name: "monitor_timezone" + policy_type: "org_config" + id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + type: org_group_policies + schema: + $ref: "#/components/schemas/OrgGroupPolicyResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an org group policy + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: - description: Update the content of an existing organization group policy. + description: Update an existing organization group policy. operationId: UpdateOrgGroupPolicy parameters: - $ref: "#/components/parameters/OrgGroupPolicyId" @@ -108749,6 +108875,7 @@ paths: attributes: content: value: "US/Eastern" + enforcement_tier: "ENFORCE" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" type: org_group_policies schema: @@ -108765,9 +108892,10 @@ paths: attributes: content: value: "US/Eastern" - enforced_at: "2024-01-15T10:30:00Z" + enforcement_tier: "ENFORCE" modified_at: "2024-01-16T14:00:00Z" policy_name: "monitor_timezone" + policy_type: "org_config" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" relationships: org_group: @@ -108881,7 +109009,7 @@ paths: - attributes: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" relationships: @@ -108940,7 +109068,7 @@ paths: value: data: attributes: - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" relationships: org_group: @@ -108966,7 +109094,7 @@ paths: attributes: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" relationships: @@ -109061,6 +109189,73 @@ 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/). + get: + description: Get a specific organization group policy override by its ID. + operationId: GetOrgGroupPolicyOverride + parameters: + - $ref: "#/components/parameters/OrgGroupPolicyOverrideId" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T10:30:00Z" + modified_at: "2024-01-15T10:30:00Z" + org_site: "us1" + org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" + id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + org_group_policy: + data: + id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + type: org_group_policies + type: org_group_policy_overrides + schema: + $ref: "#/components/schemas/OrgGroupPolicyOverrideResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an org group policy override + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: description: Update an existing organization group policy override. operationId: UpdateOrgGroupPolicyOverride @@ -109074,7 +109269,7 @@ paths: value: data: attributes: - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" type: org_group_policy_overrides @@ -109092,7 +109287,7 @@ paths: attributes: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" relationships: @@ -109164,7 +109359,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" name: "My Org Group" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -109231,7 +109426,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" name: "My Org Group" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -109334,7 +109529,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" name: "My Org Group" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -109407,7 +109602,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" name: "Updated Org Group Name" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -118804,9 +118999,8 @@ paths: /api/v2/security_monitoring/content_packs/states: get: description: |- - Get the activation and configuration states for all security monitoring content packs. - This endpoint returns status information about each content pack including activation state, - integration status, and log collection status. + Get the activation state, integration status, and log collection status + for all Cloud SIEM content packs. operationId: GetContentPacksStates responses: "200": @@ -118829,21 +119023,31 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_filters_read summary: Get content pack states tags: - Security Monitoring + "x-permission": + operator: OR + permissions: + - security_monitoring_filters_read + - logs_read_index_data 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/security_monitoring/content_packs/{content_pack_id}/activate: put: description: |- - Activate a security monitoring content pack. This operation configures the necessary + Activate a Cloud SIEM content pack. This operation configures the necessary log filters or security filters depending on the pricing model and updates the content pack activation state. operationId: ActivateContentPack parameters: - - description: The ID of the content pack to activate. + - description: The ID of the content pack to activate (for example, `aws-cloudtrail`). in: path name: content_pack_id required: true @@ -118867,20 +119071,30 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_filters_write summary: Activate content pack tags: - Security Monitoring + "x-permission": + operator: OR + permissions: + - security_monitoring_filters_write + - logs_modify_indexes 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/security_monitoring/content_packs/{content_pack_id}/deactivate: put: description: |- - Deactivate a security monitoring content pack. This operation removes the content pack's + Deactivate a Cloud SIEM content pack. This operation removes the content pack's configuration from log filters or security filters and updates the content pack activation state. operationId: DeactivateContentPack parameters: - - description: The ID of the content pack to deactivate. + - description: The ID of the content pack to deactivate (for example, `aws-cloudtrail`). in: path name: content_pack_id required: true @@ -118904,9 +119118,19 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_filters_write summary: Deactivate content pack tags: - Security Monitoring + "x-permission": + operator: OR + permissions: + - security_monitoring_filters_write + - logs_modify_indexes 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/). diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 31a81e73467..33bdb3dcfbe 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -874,6 +874,8 @@ func NewConfiguration() *Configuration { "v2.DeleteOrgGroupPolicyOverride": false, "v2.GetOrgGroup": false, "v2.GetOrgGroupMembership": false, + "v2.GetOrgGroupPolicy": false, + "v2.GetOrgGroupPolicyOverride": false, "v2.ListOrgGroupMemberships": false, "v2.ListOrgGroupPolicies": false, "v2.ListOrgGroupPolicyConfigs": false, diff --git a/api/datadogV2/api_org_groups.go b/api/datadogV2/api_org_groups.go index c9cf0509896..94c720f3116 100644 --- a/api/datadogV2/api_org_groups.go +++ b/api/datadogV2/api_org_groups.go @@ -860,6 +860,198 @@ func (a *OrgGroupsApi) GetOrgGroupMembership(ctx _context.Context, orgGroupMembe return localVarReturnValue, localVarHTTPResponse, nil } +// GetOrgGroupPolicy Get an org group policy. +// Get a specific organization group policy by its ID. +func (a *OrgGroupsApi) GetOrgGroupPolicy(ctx _context.Context, orgGroupPolicyId uuid.UUID) (OrgGroupPolicyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OrgGroupPolicyResponse + ) + + operationId := "v2.GetOrgGroupPolicy" + 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.OrgGroupsApi.GetOrgGroupPolicy") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/org_group_policies/{org_group_policy_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{org_group_policy_id}", _neturl.PathEscape(datadog.ParameterToString(orgGroupPolicyId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetOrgGroupPolicyOverride Get an org group policy override. +// Get a specific organization group policy override by its ID. +func (a *OrgGroupsApi) GetOrgGroupPolicyOverride(ctx _context.Context, orgGroupPolicyOverrideId uuid.UUID) (OrgGroupPolicyOverrideResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OrgGroupPolicyOverrideResponse + ) + + operationId := "v2.GetOrgGroupPolicyOverride" + 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.OrgGroupsApi.GetOrgGroupPolicyOverride") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/org_group_policy_overrides/{org_group_policy_override_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{org_group_policy_override_id}", _neturl.PathEscape(datadog.ParameterToString(orgGroupPolicyOverrideId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListOrgGroupMembershipsOptionalParameters holds optional parameters for ListOrgGroupMemberships. type ListOrgGroupMembershipsOptionalParameters struct { FilterOrgGroupId *uuid.UUID @@ -1778,7 +1970,7 @@ func (a *OrgGroupsApi) UpdateOrgGroupMembership(ctx _context.Context, orgGroupMe } // UpdateOrgGroupPolicy Update an org group policy. -// Update the content of an existing organization group policy. +// Update an existing organization group policy. func (a *OrgGroupsApi) UpdateOrgGroupPolicy(ctx _context.Context, orgGroupPolicyId uuid.UUID, body OrgGroupPolicyUpdateRequest) (OrgGroupPolicyResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/api/datadogV2/api_security_monitoring.go b/api/datadogV2/api_security_monitoring.go index 1955be167ba..d0fcf5e6674 100644 --- a/api/datadogV2/api_security_monitoring.go +++ b/api/datadogV2/api_security_monitoring.go @@ -21,7 +21,7 @@ import ( type SecurityMonitoringApi datadog.Service // ActivateContentPack Activate content pack. -// Activate a security monitoring content pack. This operation configures the necessary +// Activate a Cloud SIEM content pack. This operation configures the necessary // log filters or security filters depending on the pricing model and updates the content // pack activation state. func (a *SecurityMonitoringApi) ActivateContentPack(ctx _context.Context, contentPackId string) (*_nethttp.Response, error) { @@ -1844,7 +1844,7 @@ func (a *SecurityMonitoringApi) CreateVulnerabilityNotificationRule(ctx _context } // DeactivateContentPack Deactivate content pack. -// Deactivate a security monitoring content pack. This operation removes the content pack's +// Deactivate a Cloud SIEM content pack. This operation removes the content pack's // configuration from log filters or security filters and updates the content pack activation state. func (a *SecurityMonitoringApi) DeactivateContentPack(ctx _context.Context, contentPackId string) (*_nethttp.Response, error) { var ( @@ -2989,9 +2989,8 @@ func (a *SecurityMonitoringApi) ExportSecurityMonitoringTerraformResource(ctx _c } // GetContentPacksStates Get content pack states. -// Get the activation and configuration states for all security monitoring content packs. -// This endpoint returns status information about each content pack including activation state, -// integration status, and log collection status. +// Get the activation state, integration status, and log collection status +// for all Cloud SIEM content packs. func (a *SecurityMonitoringApi) GetContentPacksStates(ctx _context.Context) (SecurityMonitoringContentPackStatesResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index fc087c10d58..7fe758c9360 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -619,6 +619,8 @@ // - [OrgGroupsApi.DeleteOrgGroupPolicyOverride] // - [OrgGroupsApi.GetOrgGroup] // - [OrgGroupsApi.GetOrgGroupMembership] +// - [OrgGroupsApi.GetOrgGroupPolicy] +// - [OrgGroupsApi.GetOrgGroupPolicyOverride] // - [OrgGroupsApi.ListOrgGroupMemberships] // - [OrgGroupsApi.ListOrgGroupPolicies] // - [OrgGroupsApi.ListOrgGroupPolicyConfigs] diff --git a/api/datadogV2/model_org_group_policy_attributes.go b/api/datadogV2/model_org_group_policy_attributes.go index 7e8dbbd5985..991bcf818bf 100644 --- a/api/datadogV2/model_org_group_policy_attributes.go +++ b/api/datadogV2/model_org_group_policy_attributes.go @@ -15,12 +15,14 @@ import ( type OrgGroupPolicyAttributes struct { // The policy content as key-value pairs. Content map[string]interface{} `json:"content,omitempty"` - // Timestamp when the policy was enforced. - EnforcedAt time.Time `json:"enforced_at"` + // The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + EnforcementTier OrgGroupPolicyEnforcementTier `json:"enforcement_tier"` // Timestamp when the policy was last modified. ModifiedAt time.Time `json:"modified_at"` // The name of the policy. PolicyName string `json:"policy_name"` + // The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + PolicyType OrgGroupPolicyPolicyType `json:"policy_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:"-"` @@ -30,11 +32,12 @@ type OrgGroupPolicyAttributes struct { // 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 NewOrgGroupPolicyAttributes(enforcedAt time.Time, modifiedAt time.Time, policyName string) *OrgGroupPolicyAttributes { +func NewOrgGroupPolicyAttributes(enforcementTier OrgGroupPolicyEnforcementTier, modifiedAt time.Time, policyName string, policyType OrgGroupPolicyPolicyType) *OrgGroupPolicyAttributes { this := OrgGroupPolicyAttributes{} - this.EnforcedAt = enforcedAt + this.EnforcementTier = enforcementTier this.ModifiedAt = modifiedAt this.PolicyName = policyName + this.PolicyType = policyType return &this } @@ -43,6 +46,10 @@ func NewOrgGroupPolicyAttributes(enforcedAt time.Time, modifiedAt time.Time, pol // but it doesn't guarantee that properties required by API are set. func NewOrgGroupPolicyAttributesWithDefaults() *OrgGroupPolicyAttributes { this := OrgGroupPolicyAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = enforcementTier + var policyType OrgGroupPolicyPolicyType = ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG + this.PolicyType = policyType return &this } @@ -74,27 +81,27 @@ func (o *OrgGroupPolicyAttributes) SetContent(v map[string]interface{}) { o.Content = v } -// GetEnforcedAt returns the EnforcedAt field value. -func (o *OrgGroupPolicyAttributes) GetEnforcedAt() time.Time { +// GetEnforcementTier returns the EnforcementTier field value. +func (o *OrgGroupPolicyAttributes) GetEnforcementTier() OrgGroupPolicyEnforcementTier { if o == nil { - var ret time.Time + var ret OrgGroupPolicyEnforcementTier return ret } - return o.EnforcedAt + return o.EnforcementTier } -// GetEnforcedAtOk returns a tuple with the EnforcedAt field value +// GetEnforcementTierOk returns a tuple with the EnforcementTier field value // and a boolean to check if the value has been set. -func (o *OrgGroupPolicyAttributes) GetEnforcedAtOk() (*time.Time, bool) { +func (o *OrgGroupPolicyAttributes) GetEnforcementTierOk() (*OrgGroupPolicyEnforcementTier, bool) { if o == nil { return nil, false } - return &o.EnforcedAt, true + return &o.EnforcementTier, true } -// SetEnforcedAt sets field value. -func (o *OrgGroupPolicyAttributes) SetEnforcedAt(v time.Time) { - o.EnforcedAt = v +// SetEnforcementTier sets field value. +func (o *OrgGroupPolicyAttributes) SetEnforcementTier(v OrgGroupPolicyEnforcementTier) { + o.EnforcementTier = v } // GetModifiedAt returns the ModifiedAt field value. @@ -143,6 +150,29 @@ func (o *OrgGroupPolicyAttributes) SetPolicyName(v string) { o.PolicyName = v } +// GetPolicyType returns the PolicyType field value. +func (o *OrgGroupPolicyAttributes) GetPolicyType() OrgGroupPolicyPolicyType { + if o == nil { + var ret OrgGroupPolicyPolicyType + return ret + } + return o.PolicyType +} + +// GetPolicyTypeOk returns a tuple with the PolicyType field value +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyAttributes) GetPolicyTypeOk() (*OrgGroupPolicyPolicyType, bool) { + if o == nil { + return nil, false + } + return &o.PolicyType, true +} + +// SetPolicyType sets field value. +func (o *OrgGroupPolicyAttributes) SetPolicyType(v OrgGroupPolicyPolicyType) { + o.PolicyType = v +} + // MarshalJSON serializes the struct using spec logic. func (o OrgGroupPolicyAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -152,17 +182,14 @@ func (o OrgGroupPolicyAttributes) MarshalJSON() ([]byte, error) { if o.Content != nil { toSerialize["content"] = o.Content } - if o.EnforcedAt.Nanosecond() == 0 { - toSerialize["enforced_at"] = o.EnforcedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["enforced_at"] = o.EnforcedAt.Format("2006-01-02T15:04:05.000Z07:00") - } + toSerialize["enforcement_tier"] = o.EnforcementTier if o.ModifiedAt.Nanosecond() == 0 { toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") } else { toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") } toSerialize["policy_name"] = o.PolicyName + toSerialize["policy_type"] = o.PolicyType for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -173,16 +200,17 @@ func (o OrgGroupPolicyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgGroupPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Content map[string]interface{} `json:"content,omitempty"` - EnforcedAt *time.Time `json:"enforced_at"` - ModifiedAt *time.Time `json:"modified_at"` - PolicyName *string `json:"policy_name"` + Content map[string]interface{} `json:"content,omitempty"` + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier"` + ModifiedAt *time.Time `json:"modified_at"` + PolicyName *string `json:"policy_name"` + PolicyType *OrgGroupPolicyPolicyType `json:"policy_type"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } - if all.EnforcedAt == nil { - return fmt.Errorf("required field enforced_at missing") + if all.EnforcementTier == nil { + return fmt.Errorf("required field enforcement_tier missing") } if all.ModifiedAt == nil { return fmt.Errorf("required field modified_at missing") @@ -190,20 +218,38 @@ func (o *OrgGroupPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { if all.PolicyName == nil { return fmt.Errorf("required field policy_name missing") } + if all.PolicyType == nil { + return fmt.Errorf("required field policy_type missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforced_at", "modified_at", "policy_name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforcement_tier", "modified_at", "policy_name", "policy_type"}) } else { return err } + + hasInvalidField := false o.Content = all.Content - o.EnforcedAt = *all.EnforcedAt + if !all.EnforcementTier.IsValid() { + hasInvalidField = true + } else { + o.EnforcementTier = *all.EnforcementTier + } o.ModifiedAt = *all.ModifiedAt o.PolicyName = *all.PolicyName + if !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = *all.PolicyType + } if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_org_group_policy_create_attributes.go b/api/datadogV2/model_org_group_policy_create_attributes.go index 750d72688b7..6abfed21957 100644 --- a/api/datadogV2/model_org_group_policy_create_attributes.go +++ b/api/datadogV2/model_org_group_policy_create_attributes.go @@ -10,12 +10,16 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// OrgGroupPolicyCreateAttributes Attributes for creating an org group policy. +// OrgGroupPolicyCreateAttributes Attributes for creating an org group policy. If `policy_type` or `enforcement_tier` are not provided, they default to `org_config` and `DEFAULT` respectively. type OrgGroupPolicyCreateAttributes struct { // The policy content as key-value pairs. Content map[string]interface{} `json:"content"` + // The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` // The name of the policy. PolicyName string `json:"policy_name"` + // The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + PolicyType *OrgGroupPolicyPolicyType `json:"policy_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:"-"` @@ -28,7 +32,11 @@ type OrgGroupPolicyCreateAttributes struct { func NewOrgGroupPolicyCreateAttributes(content map[string]interface{}, policyName string) *OrgGroupPolicyCreateAttributes { this := OrgGroupPolicyCreateAttributes{} this.Content = content + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier this.PolicyName = policyName + var policyType OrgGroupPolicyPolicyType = ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG + this.PolicyType = &policyType return &this } @@ -37,6 +45,10 @@ func NewOrgGroupPolicyCreateAttributes(content map[string]interface{}, policyNam // but it doesn't guarantee that properties required by API are set. func NewOrgGroupPolicyCreateAttributesWithDefaults() *OrgGroupPolicyCreateAttributes { this := OrgGroupPolicyCreateAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier + var policyType OrgGroupPolicyPolicyType = ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG + this.PolicyType = &policyType return &this } @@ -63,6 +75,34 @@ func (o *OrgGroupPolicyCreateAttributes) SetContent(v map[string]interface{}) { o.Content = v } +// GetEnforcementTier returns the EnforcementTier field value if set, zero value otherwise. +func (o *OrgGroupPolicyCreateAttributes) GetEnforcementTier() OrgGroupPolicyEnforcementTier { + if o == nil || o.EnforcementTier == nil { + var ret OrgGroupPolicyEnforcementTier + return ret + } + return *o.EnforcementTier +} + +// GetEnforcementTierOk returns a tuple with the EnforcementTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyCreateAttributes) GetEnforcementTierOk() (*OrgGroupPolicyEnforcementTier, bool) { + if o == nil || o.EnforcementTier == nil { + return nil, false + } + return o.EnforcementTier, true +} + +// HasEnforcementTier returns a boolean if a field has been set. +func (o *OrgGroupPolicyCreateAttributes) HasEnforcementTier() bool { + return o != nil && o.EnforcementTier != nil +} + +// SetEnforcementTier gets a reference to the given OrgGroupPolicyEnforcementTier and assigns it to the EnforcementTier field. +func (o *OrgGroupPolicyCreateAttributes) SetEnforcementTier(v OrgGroupPolicyEnforcementTier) { + o.EnforcementTier = &v +} + // GetPolicyName returns the PolicyName field value. func (o *OrgGroupPolicyCreateAttributes) GetPolicyName() string { if o == nil { @@ -86,6 +126,34 @@ func (o *OrgGroupPolicyCreateAttributes) SetPolicyName(v string) { o.PolicyName = v } +// GetPolicyType returns the PolicyType field value if set, zero value otherwise. +func (o *OrgGroupPolicyCreateAttributes) GetPolicyType() OrgGroupPolicyPolicyType { + if o == nil || o.PolicyType == nil { + var ret OrgGroupPolicyPolicyType + return ret + } + return *o.PolicyType +} + +// GetPolicyTypeOk returns a tuple with the PolicyType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyCreateAttributes) GetPolicyTypeOk() (*OrgGroupPolicyPolicyType, bool) { + if o == nil || o.PolicyType == nil { + return nil, false + } + return o.PolicyType, true +} + +// HasPolicyType returns a boolean if a field has been set. +func (o *OrgGroupPolicyCreateAttributes) HasPolicyType() bool { + return o != nil && o.PolicyType != nil +} + +// SetPolicyType gets a reference to the given OrgGroupPolicyPolicyType and assigns it to the PolicyType field. +func (o *OrgGroupPolicyCreateAttributes) SetPolicyType(v OrgGroupPolicyPolicyType) { + o.PolicyType = &v +} + // MarshalJSON serializes the struct using spec logic. func (o OrgGroupPolicyCreateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -93,7 +161,13 @@ func (o OrgGroupPolicyCreateAttributes) MarshalJSON() ([]byte, error) { return datadog.Marshal(o.UnparsedObject) } toSerialize["content"] = o.Content + if o.EnforcementTier != nil { + toSerialize["enforcement_tier"] = o.EnforcementTier + } toSerialize["policy_name"] = o.PolicyName + if o.PolicyType != nil { + toSerialize["policy_type"] = o.PolicyType + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -104,8 +178,10 @@ func (o OrgGroupPolicyCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgGroupPolicyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Content *map[string]interface{} `json:"content"` - PolicyName *string `json:"policy_name"` + Content *map[string]interface{} `json:"content"` + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` + PolicyName *string `json:"policy_name"` + PolicyType *OrgGroupPolicyPolicyType `json:"policy_type,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -118,16 +194,32 @@ func (o *OrgGroupPolicyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"content", "policy_name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforcement_tier", "policy_name", "policy_type"}) } else { return err } + + hasInvalidField := false o.Content = *all.Content + if all.EnforcementTier != nil && !all.EnforcementTier.IsValid() { + hasInvalidField = true + } else { + o.EnforcementTier = all.EnforcementTier + } o.PolicyName = *all.PolicyName + if all.PolicyType != nil && !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = all.PolicyType + } if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_org_group_policy_create_data.go b/api/datadogV2/model_org_group_policy_create_data.go index 17c95127d1c..0cacd6cdb3f 100644 --- a/api/datadogV2/model_org_group_policy_create_data.go +++ b/api/datadogV2/model_org_group_policy_create_data.go @@ -12,7 +12,7 @@ import ( // OrgGroupPolicyCreateData Data for creating an org group policy. type OrgGroupPolicyCreateData struct { - // Attributes for creating an org group policy. + // Attributes for creating an org group policy. If `policy_type` or `enforcement_tier` are not provided, they default to `org_config` and `DEFAULT` respectively. Attributes OrgGroupPolicyCreateAttributes `json:"attributes"` // Relationships for creating a policy. Relationships OrgGroupPolicyCreateRelationships `json:"relationships"` diff --git a/api/datadogV2/model_org_group_policy_enforcement_tier.go b/api/datadogV2/model_org_group_policy_enforcement_tier.go new file mode 100644 index 00000000000..be22bd23928 --- /dev/null +++ b/api/datadogV2/model_org_group_policy_enforcement_tier.go @@ -0,0 +1,68 @@ +// 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" +) + +// OrgGroupPolicyEnforcementTier The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. +type OrgGroupPolicyEnforcementTier string + +// List of OrgGroupPolicyEnforcementTier. +const ( + ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT OrgGroupPolicyEnforcementTier = "DEFAULT" + ORGGROUPPOLICYENFORCEMENTTIER_ENFORCE OrgGroupPolicyEnforcementTier = "ENFORCE" + ORGGROUPPOLICYENFORCEMENTTIER_DELEGATE OrgGroupPolicyEnforcementTier = "DELEGATE" +) + +var allowedOrgGroupPolicyEnforcementTierEnumValues = []OrgGroupPolicyEnforcementTier{ + ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT, + ORGGROUPPOLICYENFORCEMENTTIER_ENFORCE, + ORGGROUPPOLICYENFORCEMENTTIER_DELEGATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OrgGroupPolicyEnforcementTier) GetAllowedValues() []OrgGroupPolicyEnforcementTier { + return allowedOrgGroupPolicyEnforcementTierEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OrgGroupPolicyEnforcementTier) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OrgGroupPolicyEnforcementTier(value) + return nil +} + +// NewOrgGroupPolicyEnforcementTierFromValue returns a pointer to a valid OrgGroupPolicyEnforcementTier +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOrgGroupPolicyEnforcementTierFromValue(v string) (*OrgGroupPolicyEnforcementTier, error) { + ev := OrgGroupPolicyEnforcementTier(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OrgGroupPolicyEnforcementTier: valid values are %v", v, allowedOrgGroupPolicyEnforcementTierEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OrgGroupPolicyEnforcementTier) IsValid() bool { + for _, existing := range allowedOrgGroupPolicyEnforcementTierEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OrgGroupPolicyEnforcementTier value. +func (v OrgGroupPolicyEnforcementTier) Ptr() *OrgGroupPolicyEnforcementTier { + return &v +} diff --git a/api/datadogV2/model_org_group_policy_override_update_attributes.go b/api/datadogV2/model_org_group_policy_override_update_attributes.go index 79826362c25..13c1f39dca8 100644 --- a/api/datadogV2/model_org_group_policy_override_update_attributes.go +++ b/api/datadogV2/model_org_group_policy_override_update_attributes.go @@ -12,7 +12,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// OrgGroupPolicyOverrideUpdateAttributes Attributes for updating a policy override. +// OrgGroupPolicyOverrideUpdateAttributes Attributes for updating a policy override. The `org_uuid` and `org_site` fields must match the existing override and cannot be changed. type OrgGroupPolicyOverrideUpdateAttributes struct { // The site of the organization. OrgSite string `json:"org_site"` diff --git a/api/datadogV2/model_org_group_policy_override_update_data.go b/api/datadogV2/model_org_group_policy_override_update_data.go index 387cda78190..a3d2667eb71 100644 --- a/api/datadogV2/model_org_group_policy_override_update_data.go +++ b/api/datadogV2/model_org_group_policy_override_update_data.go @@ -14,7 +14,7 @@ import ( // OrgGroupPolicyOverrideUpdateData Data for updating a policy override. type OrgGroupPolicyOverrideUpdateData struct { - // Attributes for updating a policy override. + // Attributes for updating a policy override. The `org_uuid` and `org_site` fields must match the existing override and cannot be changed. Attributes OrgGroupPolicyOverrideUpdateAttributes `json:"attributes"` // The ID of the policy override. Id uuid.UUID `json:"id"` diff --git a/api/datadogV2/model_org_group_policy_policy_type.go b/api/datadogV2/model_org_group_policy_policy_type.go new file mode 100644 index 00000000000..347d0a4038c --- /dev/null +++ b/api/datadogV2/model_org_group_policy_policy_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" +) + +// OrgGroupPolicyPolicyType The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. +type OrgGroupPolicyPolicyType string + +// List of OrgGroupPolicyPolicyType. +const ( + ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG OrgGroupPolicyPolicyType = "org_config" +) + +var allowedOrgGroupPolicyPolicyTypeEnumValues = []OrgGroupPolicyPolicyType{ + ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OrgGroupPolicyPolicyType) GetAllowedValues() []OrgGroupPolicyPolicyType { + return allowedOrgGroupPolicyPolicyTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OrgGroupPolicyPolicyType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OrgGroupPolicyPolicyType(value) + return nil +} + +// NewOrgGroupPolicyPolicyTypeFromValue returns a pointer to a valid OrgGroupPolicyPolicyType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOrgGroupPolicyPolicyTypeFromValue(v string) (*OrgGroupPolicyPolicyType, error) { + ev := OrgGroupPolicyPolicyType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OrgGroupPolicyPolicyType: valid values are %v", v, allowedOrgGroupPolicyPolicyTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OrgGroupPolicyPolicyType) IsValid() bool { + for _, existing := range allowedOrgGroupPolicyPolicyTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OrgGroupPolicyPolicyType value. +func (v OrgGroupPolicyPolicyType) Ptr() *OrgGroupPolicyPolicyType { + return &v +} diff --git a/api/datadogV2/model_org_group_policy_update_attributes.go b/api/datadogV2/model_org_group_policy_update_attributes.go index 834e6e129f7..7435909b3d5 100644 --- a/api/datadogV2/model_org_group_policy_update_attributes.go +++ b/api/datadogV2/model_org_group_policy_update_attributes.go @@ -12,6 +12,8 @@ import ( type OrgGroupPolicyUpdateAttributes struct { // The policy content as key-value pairs. Content map[string]interface{} `json:"content,omitempty"` + // The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,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:"-"` @@ -23,6 +25,8 @@ type OrgGroupPolicyUpdateAttributes struct { // will change when the set of required properties is changed. func NewOrgGroupPolicyUpdateAttributes() *OrgGroupPolicyUpdateAttributes { this := OrgGroupPolicyUpdateAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier return &this } @@ -31,6 +35,8 @@ func NewOrgGroupPolicyUpdateAttributes() *OrgGroupPolicyUpdateAttributes { // but it doesn't guarantee that properties required by API are set. func NewOrgGroupPolicyUpdateAttributesWithDefaults() *OrgGroupPolicyUpdateAttributes { this := OrgGroupPolicyUpdateAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier return &this } @@ -62,6 +68,34 @@ func (o *OrgGroupPolicyUpdateAttributes) SetContent(v map[string]interface{}) { o.Content = v } +// GetEnforcementTier returns the EnforcementTier field value if set, zero value otherwise. +func (o *OrgGroupPolicyUpdateAttributes) GetEnforcementTier() OrgGroupPolicyEnforcementTier { + if o == nil || o.EnforcementTier == nil { + var ret OrgGroupPolicyEnforcementTier + return ret + } + return *o.EnforcementTier +} + +// GetEnforcementTierOk returns a tuple with the EnforcementTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyUpdateAttributes) GetEnforcementTierOk() (*OrgGroupPolicyEnforcementTier, bool) { + if o == nil || o.EnforcementTier == nil { + return nil, false + } + return o.EnforcementTier, true +} + +// HasEnforcementTier returns a boolean if a field has been set. +func (o *OrgGroupPolicyUpdateAttributes) HasEnforcementTier() bool { + return o != nil && o.EnforcementTier != nil +} + +// SetEnforcementTier gets a reference to the given OrgGroupPolicyEnforcementTier and assigns it to the EnforcementTier field. +func (o *OrgGroupPolicyUpdateAttributes) SetEnforcementTier(v OrgGroupPolicyEnforcementTier) { + o.EnforcementTier = &v +} + // MarshalJSON serializes the struct using spec logic. func (o OrgGroupPolicyUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -71,6 +105,9 @@ func (o OrgGroupPolicyUpdateAttributes) MarshalJSON() ([]byte, error) { if o.Content != nil { toSerialize["content"] = o.Content } + if o.EnforcementTier != nil { + toSerialize["enforcement_tier"] = o.EnforcementTier + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -81,22 +118,34 @@ func (o OrgGroupPolicyUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgGroupPolicyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Content map[string]interface{} `json:"content,omitempty"` + Content map[string]interface{} `json:"content,omitempty"` + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"content"}) + datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforcement_tier"}) } else { return err } + + hasInvalidField := false o.Content = all.Content + if all.EnforcementTier != nil && !all.EnforcementTier.IsValid() { + hasInvalidField = true + } else { + o.EnforcementTier = all.EnforcementTier + } if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_security_monitoring_content_pack_activation.go b/api/datadogV2/model_security_monitoring_content_pack_activation.go index 673d8e2ba50..e70f331478d 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_activation.go +++ b/api/datadogV2/model_security_monitoring_content_pack_activation.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringContentPackActivation The activation status of a content pack +// SecurityMonitoringContentPackActivation The activation status of a content pack. type SecurityMonitoringContentPackActivation string // List of SecurityMonitoringContentPackActivation. diff --git a/api/datadogV2/model_security_monitoring_content_pack_integration_status.go b/api/datadogV2/model_security_monitoring_content_pack_integration_status.go index d7c5f09baec..1b4ea318a38 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_integration_status.go +++ b/api/datadogV2/model_security_monitoring_content_pack_integration_status.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringContentPackIntegrationStatus The installation status of the related integration +// SecurityMonitoringContentPackIntegrationStatus The installation status of the related integration. type SecurityMonitoringContentPackIntegrationStatus string // List of SecurityMonitoringContentPackIntegrationStatus. diff --git a/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go b/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go index 7d001030df4..36e01cd2669 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go +++ b/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go @@ -14,17 +14,18 @@ import ( type SecurityMonitoringContentPackStateAttributes struct { // Whether the cloud SIEM index configuration is incorrect (only applies to certain pricing models) CloudSiemIndexIncorrect bool `json:"cloud_siem_index_incorrect"` - // The activation status of a content pack + // The activation status of a content pack. CpActivation SecurityMonitoringContentPackActivation `json:"cp_activation"` - // Whether filters (Security Filters or Index Query depending on the pricing model) are configured for logs + // Whether filters (Security Filters or Index Query depending on the pricing model) are + // present and correctly configured to route logs into Cloud SIEM. FiltersConfiguredForLogs bool `json:"filters_configured_for_logs"` - // The installation status of the related integration + // The installation status of the related integration. IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status,omitempty"` - // Timestamp bucket indicating when logs were last collected + // Timestamp bucket indicating when logs were last collected. LogsLastCollected SecurityMonitoringContentPackTimestampBucket `json:"logs_last_collected"` - // Whether logs have been seen from any index + // Whether logs for this content pack have been seen in any Datadog index within the last 72 hours. LogsSeenFromAnyIndex bool `json:"logs_seen_from_any_index"` - // The current status of a content pack + // The current operational status of a content pack. State SecurityMonitoringContentPackStatus `json:"state"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_security_monitoring_content_pack_state_meta.go b/api/datadogV2/model_security_monitoring_content_pack_state_meta.go index dace8bc6df1..1bff5e8ac5f 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_state_meta.go +++ b/api/datadogV2/model_security_monitoring_content_pack_state_meta.go @@ -14,7 +14,7 @@ import ( type SecurityMonitoringContentPackStateMeta struct { // Whether the cloud SIEM index configuration is incorrect at the organization level CloudSiemIndexIncorrect bool `json:"cloud_siem_index_incorrect"` - // The SIEM pricing model (SKU) for the organization + // The Cloud SIEM pricing model (SKU) for the organization. Sku SecurityMonitoringSKU `json:"sku"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_security_monitoring_content_pack_status.go b/api/datadogV2/model_security_monitoring_content_pack_status.go index 6f335fe55da..850ff7bc235 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_status.go +++ b/api/datadogV2/model_security_monitoring_content_pack_status.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringContentPackStatus The current status of a content pack +// SecurityMonitoringContentPackStatus The current operational status of a content pack. type SecurityMonitoringContentPackStatus string // List of SecurityMonitoringContentPackStatus. diff --git a/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go b/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go index a3add18c230..bb2975dde6c 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go +++ b/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringContentPackTimestampBucket Timestamp bucket indicating when logs were last collected +// SecurityMonitoringContentPackTimestampBucket Timestamp bucket indicating when logs were last collected. type SecurityMonitoringContentPackTimestampBucket string // List of SecurityMonitoringContentPackTimestampBucket. diff --git a/api/datadogV2/model_security_monitoring_sku.go b/api/datadogV2/model_security_monitoring_sku.go index 0db8c66d549..24e83bbce3f 100644 --- a/api/datadogV2/model_security_monitoring_sku.go +++ b/api/datadogV2/model_security_monitoring_sku.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringSKU The SIEM pricing model (SKU) for the organization +// SecurityMonitoringSKU The Cloud SIEM pricing model (SKU) for the organization. type SecurityMonitoringSKU string // List of SecurityMonitoringSKU. diff --git a/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go b/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go index 6dce74c1774..10a0c578460 100644 --- a/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go +++ b/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go @@ -19,7 +19,7 @@ func main() { Attributes: datadogV2.OrgGroupMembershipBulkUpdateAttributes{ Orgs: []datadogV2.GlobalOrgIdentifier{ { - OrgSite: "datadoghq.com", + OrgSite: "us1", OrgUuid: uuid.MustParse("c3d4e5f6-a7b8-9012-cdef-012345678901"), }, }, diff --git a/examples/v2/org-groups/CreateOrgGroupPolicy.go b/examples/v2/org-groups/CreateOrgGroupPolicy.go index 0636dd5fc10..629d0a7b6d1 100644 --- a/examples/v2/org-groups/CreateOrgGroupPolicy.go +++ b/examples/v2/org-groups/CreateOrgGroupPolicy.go @@ -20,7 +20,9 @@ func main() { Content: map[string]interface{}{ "value": "UTC", }, - PolicyName: "monitor_timezone", + EnforcementTier: datadogV2.ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT.Ptr(), + PolicyName: "monitor_timezone", + PolicyType: datadogV2.ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG.Ptr(), }, Relationships: datadogV2.OrgGroupPolicyCreateRelationships{ OrgGroup: datadogV2.OrgGroupRelationshipToOne{ diff --git a/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go b/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go index 025656732b4..3c11e16ba52 100644 --- a/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go +++ b/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go @@ -17,7 +17,7 @@ func main() { body := datadogV2.OrgGroupPolicyOverrideCreateRequest{ Data: datadogV2.OrgGroupPolicyOverrideCreateData{ Attributes: datadogV2.OrgGroupPolicyOverrideCreateAttributes{ - OrgSite: "datadoghq.com", + OrgSite: "us1", OrgUuid: uuid.MustParse("c3d4e5f6-a7b8-9012-cdef-012345678901"), }, Relationships: datadogV2.OrgGroupPolicyOverrideCreateRelationships{ diff --git a/examples/v2/org-groups/GetOrgGroupPolicy.go b/examples/v2/org-groups/GetOrgGroupPolicy.go new file mode 100644 index 00000000000..93bcc2447ec --- /dev/null +++ b/examples/v2/org-groups/GetOrgGroupPolicy.go @@ -0,0 +1,31 @@ +// Get an org group policy returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetOrgGroupPolicy", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOrgGroupsApi(apiClient) + resp, r, err := api.GetOrgGroupPolicy(ctx, uuid.MustParse("1a2b3c4d-5e6f-7890-abcd-ef0123456789")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrgGroupsApi.GetOrgGroupPolicy`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OrgGroupsApi.GetOrgGroupPolicy`:\n%s\n", responseContent) +} diff --git a/examples/v2/org-groups/GetOrgGroupPolicyOverride.go b/examples/v2/org-groups/GetOrgGroupPolicyOverride.go new file mode 100644 index 00000000000..f97bb267ba4 --- /dev/null +++ b/examples/v2/org-groups/GetOrgGroupPolicyOverride.go @@ -0,0 +1,31 @@ +// Get an org group policy override returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetOrgGroupPolicyOverride", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOrgGroupsApi(apiClient) + resp, r, err := api.GetOrgGroupPolicyOverride(ctx, uuid.MustParse("9f8e7d6c-5b4a-3210-fedc-ba0987654321")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrgGroupsApi.GetOrgGroupPolicyOverride`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OrgGroupsApi.GetOrgGroupPolicyOverride`:\n%s\n", responseContent) +} diff --git a/examples/v2/org-groups/UpdateOrgGroupPolicy.go b/examples/v2/org-groups/UpdateOrgGroupPolicy.go index 07ae331e69a..8e368f5dbce 100644 --- a/examples/v2/org-groups/UpdateOrgGroupPolicy.go +++ b/examples/v2/org-groups/UpdateOrgGroupPolicy.go @@ -20,6 +20,7 @@ func main() { Content: map[string]interface{}{ "value": "UTC", }, + EnforcementTier: datadogV2.ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT.Ptr(), }, Id: uuid.MustParse("1a2b3c4d-5e6f-7890-abcd-ef0123456789"), Type: datadogV2.ORGGROUPPOLICYTYPE_ORG_GROUP_POLICIES, diff --git a/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go b/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go index 1f8bbeef01b..3d43d9b4856 100644 --- a/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go +++ b/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go @@ -17,7 +17,7 @@ func main() { body := datadogV2.OrgGroupPolicyOverrideUpdateRequest{ Data: datadogV2.OrgGroupPolicyOverrideUpdateData{ Attributes: datadogV2.OrgGroupPolicyOverrideUpdateAttributes{ - OrgSite: "datadoghq.com", + OrgSite: "us1", OrgUuid: uuid.MustParse("c3d4e5f6-a7b8-9012-cdef-012345678901"), }, Id: uuid.MustParse("9f8e7d6c-5b4a-3210-fedc-ba0987654321"), diff --git a/tests/scenarios/features/v2/org_groups.feature b/tests/scenarios/features/v2/org_groups.feature index 73cce63cd8e..b8c5fe1b61d 100644 --- a/tests/scenarios/features/v2/org_groups.feature +++ b/tests/scenarios/features/v2/org_groups.feature @@ -12,7 +12,7 @@ Feature: Org Groups Scenario: Bulk update org group memberships returns "Bad Request" response Given operation "BulkUpdateOrgGroupMemberships" enabled And new "BulkUpdateOrgGroupMemberships" request - And body with value {"data": {"attributes": {"orgs": [{"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} When the request is sent Then the response status is 400 Bad Request @@ -20,7 +20,7 @@ Feature: Org Groups Scenario: Bulk update org group memberships returns "Not Found" response Given operation "BulkUpdateOrgGroupMemberships" enabled And new "BulkUpdateOrgGroupMemberships" request - And body with value {"data": {"attributes": {"orgs": [{"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} When the request is sent Then the response status is 404 Not Found @@ -28,7 +28,7 @@ Feature: Org Groups Scenario: Bulk update org group memberships returns "OK" response Given operation "BulkUpdateOrgGroupMemberships" enabled And new "BulkUpdateOrgGroupMemberships" request - And body with value {"data": {"attributes": {"orgs": [{"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} When the request is sent Then the response status is 200 OK @@ -36,7 +36,7 @@ Feature: Org Groups Scenario: Create an org group policy override returns "Bad Request" response Given operation "CreateOrgGroupPolicyOverride" enabled And new "CreateOrgGroupPolicyOverride" request - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 400 Bad Request @@ -44,7 +44,7 @@ Feature: Org Groups Scenario: Create an org group policy override returns "Conflict" response Given operation "CreateOrgGroupPolicyOverride" enabled And new "CreateOrgGroupPolicyOverride" request - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 409 Conflict @@ -52,7 +52,7 @@ Feature: Org Groups Scenario: Create an org group policy override returns "Created" response Given operation "CreateOrgGroupPolicyOverride" enabled And new "CreateOrgGroupPolicyOverride" request - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 201 Created @@ -60,7 +60,7 @@ Feature: Org Groups Scenario: Create an org group policy returns "Bad Request" response Given operation "CreateOrgGroupPolicy" enabled And new "CreateOrgGroupPolicy" request - And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "policy_name": "monitor_timezone"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT", "policy_name": "monitor_timezone", "policy_type": "org_config"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} When the request is sent Then the response status is 400 Bad Request @@ -68,7 +68,7 @@ Feature: Org Groups Scenario: Create an org group policy returns "Conflict" response Given operation "CreateOrgGroupPolicy" enabled And new "CreateOrgGroupPolicy" request - And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "policy_name": "monitor_timezone"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT", "policy_name": "monitor_timezone", "policy_type": "org_config"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} When the request is sent Then the response status is 409 Conflict @@ -76,7 +76,7 @@ Feature: Org Groups Scenario: Create an org group policy returns "Created" response Given operation "CreateOrgGroupPolicy" enabled And new "CreateOrgGroupPolicy" request - And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "policy_name": "monitor_timezone"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT", "policy_name": "monitor_timezone", "policy_type": "org_config"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} When the request is sent Then the response status is 201 Created @@ -200,6 +200,54 @@ Feature: Org Groups When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy override returns "Bad Request" response + Given operation "GetOrgGroupPolicyOverride" enabled + And new "GetOrgGroupPolicyOverride" request + And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy override returns "Not Found" response + Given operation "GetOrgGroupPolicyOverride" enabled + And new "GetOrgGroupPolicyOverride" request + And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy override returns "OK" response + Given operation "GetOrgGroupPolicyOverride" enabled + And new "GetOrgGroupPolicyOverride" request + And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy returns "Bad Request" response + Given operation "GetOrgGroupPolicy" enabled + And new "GetOrgGroupPolicy" request + And request contains "org_group_policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy returns "Not Found" response + Given operation "GetOrgGroupPolicy" enabled + And new "GetOrgGroupPolicy" request + And request contains "org_group_policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy returns "OK" response + Given operation "GetOrgGroupPolicy" enabled + And new "GetOrgGroupPolicy" request + And request contains "org_group_policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/org-management Scenario: Get an org group returns "Bad Request" response Given operation "GetOrgGroup" enabled @@ -323,7 +371,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicyOverride" enabled And new "UpdateOrgGroupPolicyOverride" request And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 400 Bad Request @@ -332,7 +380,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicyOverride" enabled And new "UpdateOrgGroupPolicyOverride" request And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 404 Not Found @@ -341,7 +389,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicyOverride" enabled And new "UpdateOrgGroupPolicyOverride" request And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 200 OK @@ -350,7 +398,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicy" enabled And new "UpdateOrgGroupPolicy" request And request contains "org_group_policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"content": {"value": "UTC"}}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 400 Bad Request @@ -359,7 +407,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicy" enabled And new "UpdateOrgGroupPolicy" request And request contains "org_group_policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"content": {"value": "UTC"}}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 404 Not Found @@ -368,7 +416,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicy" enabled And new "UpdateOrgGroupPolicy" request And request contains "org_group_policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"content": {"value": "UTC"}}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 31f26b91091..9152f6b2278 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4222,6 +4222,12 @@ "type": "unsafe" } }, + "GetOrgGroupPolicy": { + "tag": "Org Groups", + "undo": { + "type": "safe" + } + }, "UpdateOrgGroupPolicy": { "tag": "Org Groups", "undo": { @@ -4258,6 +4264,12 @@ "type": "unsafe" } }, + "GetOrgGroupPolicyOverride": { + "tag": "Org Groups", + "undo": { + "type": "safe" + } + }, "UpdateOrgGroupPolicyOverride": { "tag": "Org Groups", "undo": {