From 0c92ec7ea8f665e63e2c8eba0ebf6cfe9ef11f89 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 12 Sep 2024 13:53:43 +0000 Subject: [PATCH] Regenerate client from commit 567a9707 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 428 ++++++++++++++++++ .../CreateASMExclusionFilter.rb | 25 + .../DeleteASMExclusionFilter.rb | 5 + .../GetASMExclusionFilters.rb | 5 + .../ListASMExclusionFilters.rb | 5 + .../UpdateASMExclusionFilter.rb | 32 ++ features/scenarios_model_mapping.rb | 13 + features/v2/asm_exclusion_filters.feature | 89 ++++ features/v2/given.json | 12 + features/v2/undo.json | 37 ++ lib/datadog_api_client/inflector.rb | 19 + .../v2/api/asm_exclusion_filters_api.rb | 356 +++++++++++++++ .../models/asm_exclusion_filter_attributes.rb | 171 +++++++ .../asm_exclusion_filter_create_attributes.rb | 190 ++++++++ .../asm_exclusion_filter_create_data.rb | 144 ++++++ .../asm_exclusion_filter_create_request.rb | 123 +++++ .../v2/models/asm_exclusion_filter_data.rb | 125 +++++ .../asm_exclusion_filter_list_attributes.rb | 171 +++++++ .../asm_exclusion_filter_list_response.rb | 107 +++++ .../asm_exclusion_filter_list_rules_target.rb | 105 +++++ ...exclusion_filter_list_rules_target_tags.rb | 115 +++++ .../models/asm_exclusion_filter_metadata.rb | 135 ++++++ .../models/asm_exclusion_filter_response.rb | 107 +++++ .../asm_exclusion_filter_rules_target.rb | 115 +++++ .../v2/models/asm_exclusion_filter_scope.rb | 115 +++++ .../v2/models/asm_exclusion_filter_type.rb | 26 ++ .../asm_exclusion_filter_update_attributes.rb | 190 ++++++++ .../asm_exclusion_filter_update_data.rb | 154 +++++++ .../asm_exclusion_filter_update_request.rb | 123 +++++ .../models/asm_exclusion_list_filter_data.rb | 125 +++++ 31 files changed, 3371 insertions(+), 4 deletions(-) create mode 100644 examples/v2/asm-exclusion-filters/CreateASMExclusionFilter.rb create mode 100644 examples/v2/asm-exclusion-filters/DeleteASMExclusionFilter.rb create mode 100644 examples/v2/asm-exclusion-filters/GetASMExclusionFilters.rb create mode 100644 examples/v2/asm-exclusion-filters/ListASMExclusionFilters.rb create mode 100644 examples/v2/asm-exclusion-filters/UpdateASMExclusionFilter.rb create mode 100644 features/v2/asm_exclusion_filters.feature create mode 100644 lib/datadog_api_client/v2/api/asm_exclusion_filters_api.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_data.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_list_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target_tags.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_metadata.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_response.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_rules_target.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_scope.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_type.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_filter_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/asm_exclusion_list_filter_data.rb diff --git a/.apigentools-info b/.apigentools-info index 1c7f2bb1abf4..98dae46f5335 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-12 09:37:08.539854", - "spec_repo_commit": "7c86a87a" + "regenerated": "2024-09-12 13:53:20.103142", + "spec_repo_commit": "567a9707" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-12 09:37:08.558706", - "spec_repo_commit": "7c86a87a" + "regenerated": "2024-09-12 13:53:20.121047", + "spec_repo_commit": "567a9707" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b97ac37f80c8..b9e676c2a581 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -84,6 +84,14 @@ components: required: false schema: $ref: '#/components/schemas/APIKeysSort' + ASMExclusionFilterID: + description: The ID of the exclusion filter. + example: 3b5-v82-ns6 + in: path + name: exclusion_filter_id + required: true + schema: + type: string ApplicationKeyFilterCreatedAtEndParameter: description: Only include application keys created on or before the specified date. @@ -907,6 +915,304 @@ components: type: string x-enum-varnames: - API_KEYS + ASMExclusionFilterAttributes: + description: The attributes of the ASM WAF exclusion filter. + properties: + description: + description: A description for the exclusion filter. + example: Test exclude path + type: string + enabled: + description: Indicates whether the exclusion filter is enabled. + example: false + type: boolean + ip_list: + description: The IPs list for the exclusion filter. + items: + example: 127.0.0.1 + type: string + type: array + metadata: + $ref: '#/components/schemas/ASMExclusionFilterMetadata' + path_glob: + description: The path glob for the exclusion filter. + example: /lfi_include/* + type: string + rules_target: + description: A list of rules targeted by the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterRulesTarget' + type: array + scope: + description: The scope of the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterScope' + type: array + type: object + ASMExclusionFilterCreateAttributes: + description: Create a new ASM WAF exclusion filter. + properties: + description: + description: A description for the exclusion filter. + example: Test exclude path + type: string + enabled: + description: Indicates whether the exclusion filter is enabled. + example: false + type: boolean + ip_list: + description: The IPs list for the exclusion filter. + items: + example: 127.0.0.1 + type: string + type: array + path_glob: + description: The path glob for the exclusion filter. + example: /lfi_include/* + type: string + rules_target: + description: A list of rules targeted by the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterRulesTarget' + type: array + scope: + description: The scope of the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterScope' + type: array + required: + - description + - enabled + ASMExclusionFilterCreateData: + description: Object for a single exclusion filter. + properties: + attributes: + $ref: '#/components/schemas/ASMExclusionFilterCreateAttributes' + type: + $ref: '#/components/schemas/ASMExclusionFilterType' + required: + - attributes + - type + type: object + ASMExclusionFilterCreateRequest: + description: Request object that includes the exclusion filter to create. + properties: + data: + $ref: '#/components/schemas/ASMExclusionFilterCreateData' + required: + - data + type: object + ASMExclusionFilterData: + description: Object for a single Exclusion filter. + properties: + attributes: + $ref: '#/components/schemas/ASMExclusionFilterAttributes' + id: + description: The ID of the Exclusion filter. + example: 3dd-0uc-h1s + type: string + type: + $ref: '#/components/schemas/ASMExclusionFilterType' + type: object + ASMExclusionFilterID: + description: The ID of the exclusion filter. + example: 3dd-0uc-h1s + type: string + ASMExclusionFilterListAttributes: + description: The attributes of the ASM WAF exclusion filter. + properties: + description: + description: A description for the exclusion filter. + example: Test exclude path + type: string + enabled: + description: Indicates whether the exclusion filter is enabled. + example: false + type: boolean + ip_list: + description: The IPs list for the exclusion filter. + items: + example: 127.0.0.1 + type: string + type: array + metadata: + $ref: '#/components/schemas/ASMExclusionFilterMetadata' + path_glob: + description: The path glob for the exclusion filter. + example: /lfi_include/* + type: string + rules_target: + description: A list of rules targeted by the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterListRulesTarget' + type: array + scope: + description: The scope of the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterScope' + type: array + type: object + ASMExclusionFilterListResponse: + description: Response object that includes a list of exclusion filters. + properties: + data: + description: The ASMExclusionFilterResponse data. + items: + $ref: '#/components/schemas/ASMExclusionListFilterData' + type: array + type: object + ASMExclusionFilterListRulesTarget: + description: A rule targeted by the exclusion filter. + properties: + tags: + $ref: '#/components/schemas/ASMExclusionFilterListRulesTargetTags' + type: object + ASMExclusionFilterListRulesTargetTags: + description: Tags identifying the category and type of the targeted rule. + properties: + category: + description: The category of the rule. + example: attack_attempt + type: string + type: + description: The type of the rule. + example: lfi + type: string + type: object + ASMExclusionFilterMetadata: + description: Metadata about the exclusion filter. + properties: + added_at: + description: The timestamp when the exclusion filter was added. + example: '2023-05-04T15:26:41Z' + format: date-time + type: string + added_by: + description: The email address of the user who added the exclusion filter. + example: xxxx@xxxx.com + type: string + modified_at: + description: The timestamp when the exclusion filter was last modified. + example: '2023-05-30T15:45:51Z' + format: date-time + type: string + modified_by: + description: The email address of the user who last modified the exclusion + filter. + example: xxx@xxx.com + type: string + type: object + ASMExclusionFilterResponse: + description: Response object that includes a list of exclusion filters. + properties: + data: + description: The ASMExclusionFilterResponse data. + items: + $ref: '#/components/schemas/ASMExclusionFilterData' + type: array + type: object + ASMExclusionFilterRulesTarget: + description: A rule targeted by the exclusion filter. + properties: + rule_id: + description: The ID of the targeted rule. + example: dog-913-009 + type: string + rule_name: + description: The name of the targeted rule. + example: WhiteHat Security OOB domain + type: string + type: object + ASMExclusionFilterScope: + description: The scope of the exclusion filter. + properties: + env: + description: The environment scope for the exclusion filter. + example: dd-appsec-php-support + type: string + service: + description: The service scope for the exclusion filter. + example: anil-php-weblog + type: string + type: object + ASMExclusionFilterType: + default: exclusion_filter + description: The type of the resource. The value should always be `exclusion_filter`. + enum: + - exclusion_filter + example: exclusion_filter + type: string + x-enum-varnames: + - EXCLUSION_FILTER + ASMExclusionFilterUpdateAttributes: + description: Update an existing ASM Exclusion filter. + properties: + description: + description: The description of the Exclusion filter. + example: My Exclusion filter + type: string + enabled: + description: Whether the Exclusion filter is enabled. + example: true + type: boolean + ip_list: + description: The IPs list for the exclusion filter. + items: + example: 127.0.0.1 + type: string + type: array + path_glob: + description: The path glob for the exclusion filter. + example: /lfi_include/* + type: string + rules_target: + description: A list of rules targeted by the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterRulesTarget' + type: array + scope: + description: The scope of the exclusion filter. + items: + $ref: '#/components/schemas/ASMExclusionFilterScope' + type: array + required: + - description + - enabled + type: object + ASMExclusionFilterUpdateData: + description: Object for a single Exclusion filter. + properties: + attributes: + $ref: '#/components/schemas/ASMExclusionFilterUpdateAttributes' + id: + $ref: '#/components/schemas/ASMExclusionFilterID' + type: + $ref: '#/components/schemas/ASMExclusionFilterType' + required: + - attributes + - type + type: object + ASMExclusionFilterUpdateRequest: + description: Request object that includes the Exclusion filter with the attributes + to update. + properties: + data: + $ref: '#/components/schemas/ASMExclusionFilterUpdateData' + required: + - data + type: object + ASMExclusionListFilterData: + description: Object for a single Exclusion filter. + properties: + attributes: + $ref: '#/components/schemas/ASMExclusionFilterListAttributes' + id: + description: The ID of the Exclusion filter. + example: 3dd-0uc-h1s + type: string + type: + $ref: '#/components/schemas/ASMExclusionFilterType' + type: object AWSRelatedAccount: description: AWS related account. properties: @@ -33577,6 +33883,125 @@ paths: We are gradually onboarding support for more sources. If you have any feedback, contact [Datadog Support](https://docs.datadoghq.com/help/).' + /api/v2/remote_config/products/asm/waf/exclusion_filters: + get: + description: Retrieve a list of ASM exclusion filters. + operationId: ListASMExclusionFilters + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ASMExclusionFilterListResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List ASM Exclusion Filters + tags: + - ASM Exclusion Filters + post: + description: Create a new exclusion filter with the given parameters. + operationId: CreateASMExclusionFilter + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ASMExclusionFilterCreateRequest' + description: The definition of the new Exclusion filter. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ASMExclusionFilterResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a ASM WAF Exclusion filter + tags: + - ASM Exclusion Filters + x-codegen-request-body-name: body + /api/v2/remote_config/products/asm/waf/exclusion_filters/{exclusion_filter_id}: + delete: + description: Delete a specific ASM Exclusion filter. + operationId: DeleteASMExclusionFilter + parameters: + - $ref: '#/components/parameters/ASMExclusionFilterID' + responses: + '204': + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a ASM Exclusion Filter + tags: + - ASM Exclusion Filters + get: + description: Retrieve a specific ASM exclusion filter by ID. + operationId: GetASMExclusionFilters + parameters: + - $ref: '#/components/parameters/ASMExclusionFilterID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ASMExclusionFilterResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a specific ASM Exclusion Filter + tags: + - ASM Exclusion Filters + patch: + description: 'Update a specific Exclusion filter. + + Returns the Exclusion filter object when the request is successful.' + operationId: UpdateASMExclusionFilter + parameters: + - $ref: '#/components/parameters/ASMExclusionFilterID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ASMExclusionFilterUpdateRequest' + description: New definition of the Exclusion filter. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ASMExclusionFilterResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConcurrentModificationResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a ASM Exclusion filter + tags: + - ASM Exclusion Filters + x-codegen-request-body-name: body /api/v2/remote_config/products/cws/agent_rules: get: description: Get the list of Cloud Security Management Threats Agent rules. @@ -39496,6 +39921,9 @@ tags: description: Find out more at url: https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/ name: APM Retention Filters +- description: Exclusion filters in ASM libraries are used to circumvent false positives + in protection. + name: ASM Exclusion Filters - description: Search your Audit Logs events over HTTP. name: Audit - description: '[The AuthN Mappings API](https://docs.datadoghq.com/account_management/authn_mapping/?tab=example) diff --git a/examples/v2/asm-exclusion-filters/CreateASMExclusionFilter.rb b/examples/v2/asm-exclusion-filters/CreateASMExclusionFilter.rb new file mode 100644 index 000000000000..2cf20e8008d3 --- /dev/null +++ b/examples/v2/asm-exclusion-filters/CreateASMExclusionFilter.rb @@ -0,0 +1,25 @@ +# Create a ASM WAF Exclusion filter returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ASMExclusionFiltersAPI.new + +body = DatadogAPIClient::V2::ASMExclusionFilterCreateRequest.new({ + data: DatadogAPIClient::V2::ASMExclusionFilterCreateData.new({ + type: DatadogAPIClient::V2::ASMExclusionFilterType::EXCLUSION_FILTER, + attributes: DatadogAPIClient::V2::ASMExclusionFilterCreateAttributes.new({ + description: "my description", + enabled: true, + path_glob: "*", + rules_target: [ + DatadogAPIClient::V2::ASMExclusionFilterRulesTarget.new({}), + ], + scope: [ + DatadogAPIClient::V2::ASMExclusionFilterScope.new({ + env: "staging", + service: "container-resolver", + }), + ], + }), + }), +}) +p api_instance.create_asm_exclusion_filter(body) diff --git a/examples/v2/asm-exclusion-filters/DeleteASMExclusionFilter.rb b/examples/v2/asm-exclusion-filters/DeleteASMExclusionFilter.rb new file mode 100644 index 000000000000..a4392c99ebeb --- /dev/null +++ b/examples/v2/asm-exclusion-filters/DeleteASMExclusionFilter.rb @@ -0,0 +1,5 @@ +# Delete a ASM Exclusion Filter returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ASMExclusionFiltersAPI.new +api_instance.delete_asm_exclusion_filter("exclusion_filter_id") diff --git a/examples/v2/asm-exclusion-filters/GetASMExclusionFilters.rb b/examples/v2/asm-exclusion-filters/GetASMExclusionFilters.rb new file mode 100644 index 000000000000..e46ee5fd9590 --- /dev/null +++ b/examples/v2/asm-exclusion-filters/GetASMExclusionFilters.rb @@ -0,0 +1,5 @@ +# Get a specific ASM Exclusion Filter returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ASMExclusionFiltersAPI.new +p api_instance.get_asm_exclusion_filters("exclusion_filter_id") diff --git a/examples/v2/asm-exclusion-filters/ListASMExclusionFilters.rb b/examples/v2/asm-exclusion-filters/ListASMExclusionFilters.rb new file mode 100644 index 000000000000..5b3e7924530e --- /dev/null +++ b/examples/v2/asm-exclusion-filters/ListASMExclusionFilters.rb @@ -0,0 +1,5 @@ +# List ASM Exclusion Filters returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ASMExclusionFiltersAPI.new +p api_instance.list_asm_exclusion_filters() diff --git a/examples/v2/asm-exclusion-filters/UpdateASMExclusionFilter.rb b/examples/v2/asm-exclusion-filters/UpdateASMExclusionFilter.rb new file mode 100644 index 000000000000..55371d97b440 --- /dev/null +++ b/examples/v2/asm-exclusion-filters/UpdateASMExclusionFilter.rb @@ -0,0 +1,32 @@ +# Update a ASM Exclusion filter returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ASMExclusionFiltersAPI.new + +body = DatadogAPIClient::V2::ASMExclusionFilterUpdateRequest.new({ + data: DatadogAPIClient::V2::ASMExclusionFilterUpdateData.new({ + attributes: DatadogAPIClient::V2::ASMExclusionFilterUpdateAttributes.new({ + description: "My Exclusion filter", + enabled: true, + ip_list: [ + "127.0.0.1", + ], + path_glob: "/lfi_include/*", + rules_target: [ + DatadogAPIClient::V2::ASMExclusionFilterRulesTarget.new({ + rule_id: "dog-913-009", + rule_name: "WhiteHat Security OOB domain", + }), + ], + scope: [ + DatadogAPIClient::V2::ASMExclusionFilterScope.new({ + env: "dd-appsec-php-support", + service: "anil-php-weblog", + }), + ], + }), + id: "3dd-0uc-h1s", + type: DatadogAPIClient::V2::ASMExclusionFilterType::EXCLUSION_FILTER, + }), +}) +p api_instance.update_asm_exclusion_filter("exclusion_filter_id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 958e882dee50..f5282a309245 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1769,6 +1769,19 @@ "page_limit" => "Integer", "page_cursor" => "String", }, + "v2.CreateASMExclusionFilter" => { + "body" => "ASMExclusionFilterCreateRequest", + }, + "v2.DeleteASMExclusionFilter" => { + "exclusion_filter_id" => "String", + }, + "v2.GetASMExclusionFilters" => { + "exclusion_filter_id" => "String", + }, + "v2.UpdateASMExclusionFilter" => { + "exclusion_filter_id" => "String", + "body" => "ASMExclusionFilterUpdateRequest", + }, "v2.CreateCSMThreatsAgentRule" => { "body" => "CloudWorkloadSecurityAgentRuleCreateRequest", }, diff --git a/features/v2/asm_exclusion_filters.feature b/features/v2/asm_exclusion_filters.feature new file mode 100644 index 000000000000..56e415b4605e --- /dev/null +++ b/features/v2/asm_exclusion_filters.feature @@ -0,0 +1,89 @@ +@endpoint(asm-exclusion-filters) @endpoint(asm-exclusion-filters-v2) +Feature: ASM Exclusion Filters + Exclusion filters in ASM libraries are used to circumvent false positives + in protection. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ASMExclusionFilters" API + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Create a ASM WAF Exclusion filter returns "Bad Request" response + Given new "CreateASMExclusionFilter" request + And body with value {"data": {"type": "exclusion_filter"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Create a ASM WAF Exclusion filter returns "Conflict" response + Given new "CreateASMExclusionFilter" request + And body with value {"data": {"type": "exclusion_filter"}} + When the request is sent + Then the response status is 409 Conflict + + @skip @team:DataDog/asm-respond-backend + Scenario: Create a ASM WAF Exclusion filter returns "OK" response + Given new "CreateASMExclusionFilter" request + And body with value {"data": {"type": "exclusion_filter","attributes":{"description":"my description","enabled":true,"path_glob":"*","rules_target":[{"tags":{"category":"attack_attempt","type":"sql_injection"}}],"scope":[{"env":"staging","service":"container-resolver"}]}}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Delete a ASM Exclusion Filter returns "Not Found" response + Given new "DeleteASMExclusionFilter" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Delete a ASM Exclusion Filter returns "OK" response + Given new "DeleteASMExclusionFilter" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Get a specific ASM Exclusion Filter returns "OK" response + Given new "GetASMExclusionFilters" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: List ASM Exclusion Filters returns "OK" response + Given new "ListASMExclusionFilters" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Update a ASM Exclusion filter returns "Bad Request" response + Given new "UpdateASMExclusionFilter" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "My Exclusion filter", "enabled": true, "ip_list": ["127.0.0.1"], "path_glob": "/lfi_include/*", "rules_target": [{"rule_id": "dog-913-009", "rule_name": "WhiteHat Security OOB domain"}], "scope": [{"env": "dd-appsec-php-support", "service": "anil-php-weblog"}]}, "id": "3dd-0uc-h1s", "type": "exclusion_filter"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Update a ASM Exclusion filter returns "Concurrent Modification" response + Given new "UpdateASMExclusionFilter" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "My Exclusion filter", "enabled": true, "ip_list": ["127.0.0.1"], "path_glob": "/lfi_include/*", "rules_target": [{"rule_id": "dog-913-009", "rule_name": "WhiteHat Security OOB domain"}], "scope": [{"env": "dd-appsec-php-support", "service": "anil-php-weblog"}]}, "id": "3dd-0uc-h1s", "type": "exclusion_filter"}} + When the request is sent + Then the response status is 409 Concurrent Modification + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Update a ASM Exclusion filter returns "Not Found" response + Given new "UpdateASMExclusionFilter" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "My Exclusion filter", "enabled": true, "ip_list": ["127.0.0.1"], "path_glob": "/lfi_include/*", "rules_target": [{"rule_id": "dog-913-009", "rule_name": "WhiteHat Security OOB domain"}], "scope": [{"env": "dd-appsec-php-support", "service": "anil-php-weblog"}]}, "id": "3dd-0uc-h1s", "type": "exclusion_filter"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/asm-respond-backend + Scenario: Update a ASM Exclusion filter returns "OK" response + Given new "UpdateASMExclusionFilter" request + And request contains "exclusion_filter_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "My Exclusion filter", "enabled": true, "ip_list": ["127.0.0.1"], "path_glob": "/lfi_include/*", "rules_target": [{"rule_id": "dog-913-009", "rule_name": "WhiteHat Security OOB domain"}], "scope": [{"env": "dd-appsec-php-support", "service": "anil-php-weblog"}]}, "id": "3dd-0uc-h1s", "type": "exclusion_filter"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/given.json b/features/v2/given.json index 65187625d3fa..d9b1d6a99799 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -379,6 +379,18 @@ "tag": "Powerpack", "operationId": "CreatePowerpack" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"exclusion_filter\",\n \"attributes\": {\n \"description\": \"My Exclusion Filter\",\n \"enabled\": true,\n \"path_glob\": \"*\",\n \"rules_target\": [\n {\n \"tags\": {\n \"category\":\"attack_attempt\",\n \"type\":\"xss\"\n }\n }\n ],\n \"scope\": [\n {\n \"env\": \"staging\",\n \"service\": \"event-query\"\n }\n ]\n }\n }\n}" + } + ], + "step": "there is a valid \"exclusion_filter\" in the system", + "key": "exclusion_filter", + "tag": "ASM Exclusion Filters", + "operationId": "CreateASMExclusionFilter" + }, { "parameters": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index c8228c1a92e3..12ae99663ca4 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1473,6 +1473,43 @@ "type": "idempotent" } }, + "ListASMExclusionFilters": { + "tag": "ASM Exclusion Filters", + "undo": { + "type": "safe" + } + }, + "CreateASMExclusionFilter": { + "tag": "ASM Exclusion Filters", + "undo": { + "operationId": "DeleteASMExclusionFilter", + "parameters": [ + { + "name": "exclusion_filter_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteASMExclusionFilter": { + "tag": "ASM Exclusion Filters", + "undo": { + "type": "idempotent" + } + }, + "GetASMExclusionFilters": { + "tag": "ASM Exclusion Filters", + "undo": { + "type": "safe" + } + }, + "UpdateASMExclusionFilter": { + "tag": "ASM Exclusion Filters", + "undo": { + "type": "idempotent" + } + }, "ListCSMThreatsAgentRules": { "tag": "CSM Threats", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 3034d1bd750d..28accb9e9492 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -906,6 +906,24 @@ def overrides "v2.application_key_update_attributes" => "ApplicationKeyUpdateAttributes", "v2.application_key_update_data" => "ApplicationKeyUpdateData", "v2.application_key_update_request" => "ApplicationKeyUpdateRequest", + "v2.asm_exclusion_filter_attributes" => "ASMExclusionFilterAttributes", + "v2.asm_exclusion_filter_create_attributes" => "ASMExclusionFilterCreateAttributes", + "v2.asm_exclusion_filter_create_data" => "ASMExclusionFilterCreateData", + "v2.asm_exclusion_filter_create_request" => "ASMExclusionFilterCreateRequest", + "v2.asm_exclusion_filter_data" => "ASMExclusionFilterData", + "v2.asm_exclusion_filter_list_attributes" => "ASMExclusionFilterListAttributes", + "v2.asm_exclusion_filter_list_response" => "ASMExclusionFilterListResponse", + "v2.asm_exclusion_filter_list_rules_target" => "ASMExclusionFilterListRulesTarget", + "v2.asm_exclusion_filter_list_rules_target_tags" => "ASMExclusionFilterListRulesTargetTags", + "v2.asm_exclusion_filter_metadata" => "ASMExclusionFilterMetadata", + "v2.asm_exclusion_filter_response" => "ASMExclusionFilterResponse", + "v2.asm_exclusion_filter_rules_target" => "ASMExclusionFilterRulesTarget", + "v2.asm_exclusion_filter_scope" => "ASMExclusionFilterScope", + "v2.asm_exclusion_filter_type" => "ASMExclusionFilterType", + "v2.asm_exclusion_filter_update_attributes" => "ASMExclusionFilterUpdateAttributes", + "v2.asm_exclusion_filter_update_data" => "ASMExclusionFilterUpdateData", + "v2.asm_exclusion_filter_update_request" => "ASMExclusionFilterUpdateRequest", + "v2.asm_exclusion_list_filter_data" => "ASMExclusionListFilterData", "v2.audit_logs_event" => "AuditLogsEvent", "v2.audit_logs_event_attributes" => "AuditLogsEventAttributes", "v2.audit_logs_events_response" => "AuditLogsEventsResponse", @@ -2501,6 +2519,7 @@ def overrides "v1.webhooks_integration_api" => "WebhooksIntegrationAPI", "v2.api_management_api" => "APIManagementAPI", "v2.apm_retention_filters_api" => "APMRetentionFiltersAPI", + "v2.asm_exclusion_filters_api" => "ASMExclusionFiltersAPI", "v2.audit_api" => "AuditAPI", "v2.authn_mappings_api" => "AuthNMappingsAPI", "v2.case_management_api" => "CaseManagementAPI", diff --git a/lib/datadog_api_client/v2/api/asm_exclusion_filters_api.rb b/lib/datadog_api_client/v2/api/asm_exclusion_filters_api.rb new file mode 100644 index 000000000000..f1fae98f3c98 --- /dev/null +++ b/lib/datadog_api_client/v2/api/asm_exclusion_filters_api.rb @@ -0,0 +1,356 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class ASMExclusionFiltersAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a ASM WAF Exclusion filter. + # + # @see #create_asm_exclusion_filter_with_http_info + def create_asm_exclusion_filter(body, opts = {}) + data, _status_code, _headers = create_asm_exclusion_filter_with_http_info(body, opts) + data + end + + # Create a ASM WAF Exclusion filter. + # + # Create a new exclusion filter with the given parameters. + # + # @param body [ASMExclusionFilterCreateRequest] The definition of the new Exclusion filter. + # @param opts [Hash] the optional parameters + # @return [Array<(ASMExclusionFilterResponse, Integer, Hash)>] ASMExclusionFilterResponse data, response status code and response headers + def create_asm_exclusion_filter_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ASMExclusionFiltersAPI.create_asm_exclusion_filter ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ASMExclusionFiltersAPI.create_asm_exclusion_filter" + end + # resource path + local_var_path = '/api/v2/remote_config/products/asm/waf/exclusion_filters' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ASMExclusionFilterResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_asm_exclusion_filter, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ASMExclusionFiltersAPI#create_asm_exclusion_filter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a ASM Exclusion Filter. + # + # @see #delete_asm_exclusion_filter_with_http_info + def delete_asm_exclusion_filter(exclusion_filter_id, opts = {}) + delete_asm_exclusion_filter_with_http_info(exclusion_filter_id, opts) + nil + end + + # Delete a ASM Exclusion Filter. + # + # Delete a specific ASM Exclusion filter. + # + # @param exclusion_filter_id [String] The ID of the exclusion filter. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_asm_exclusion_filter_with_http_info(exclusion_filter_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ASMExclusionFiltersAPI.delete_asm_exclusion_filter ...' + end + # verify the required parameter 'exclusion_filter_id' is set + if @api_client.config.client_side_validation && exclusion_filter_id.nil? + fail ArgumentError, "Missing the required parameter 'exclusion_filter_id' when calling ASMExclusionFiltersAPI.delete_asm_exclusion_filter" + end + # resource path + local_var_path = '/api/v2/remote_config/products/asm/waf/exclusion_filters/{exclusion_filter_id}'.sub('{exclusion_filter_id}', CGI.escape(exclusion_filter_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_asm_exclusion_filter, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ASMExclusionFiltersAPI#delete_asm_exclusion_filter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a specific ASM Exclusion Filter. + # + # @see #get_asm_exclusion_filters_with_http_info + def get_asm_exclusion_filters(exclusion_filter_id, opts = {}) + data, _status_code, _headers = get_asm_exclusion_filters_with_http_info(exclusion_filter_id, opts) + data + end + + # Get a specific ASM Exclusion Filter. + # + # Retrieve a specific ASM exclusion filter by ID. + # + # @param exclusion_filter_id [String] The ID of the exclusion filter. + # @param opts [Hash] the optional parameters + # @return [Array<(ASMExclusionFilterResponse, Integer, Hash)>] ASMExclusionFilterResponse data, response status code and response headers + def get_asm_exclusion_filters_with_http_info(exclusion_filter_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ASMExclusionFiltersAPI.get_asm_exclusion_filters ...' + end + # verify the required parameter 'exclusion_filter_id' is set + if @api_client.config.client_side_validation && exclusion_filter_id.nil? + fail ArgumentError, "Missing the required parameter 'exclusion_filter_id' when calling ASMExclusionFiltersAPI.get_asm_exclusion_filters" + end + # resource path + local_var_path = '/api/v2/remote_config/products/asm/waf/exclusion_filters/{exclusion_filter_id}'.sub('{exclusion_filter_id}', CGI.escape(exclusion_filter_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ASMExclusionFilterResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_asm_exclusion_filters, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ASMExclusionFiltersAPI#get_asm_exclusion_filters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List ASM Exclusion Filters. + # + # @see #list_asm_exclusion_filters_with_http_info + def list_asm_exclusion_filters(opts = {}) + data, _status_code, _headers = list_asm_exclusion_filters_with_http_info(opts) + data + end + + # List ASM Exclusion Filters. + # + # Retrieve a list of ASM exclusion filters. + # + # @param opts [Hash] the optional parameters + # @return [Array<(ASMExclusionFilterListResponse, Integer, Hash)>] ASMExclusionFilterListResponse data, response status code and response headers + def list_asm_exclusion_filters_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ASMExclusionFiltersAPI.list_asm_exclusion_filters ...' + end + # resource path + local_var_path = '/api/v2/remote_config/products/asm/waf/exclusion_filters' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ASMExclusionFilterListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_asm_exclusion_filters, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ASMExclusionFiltersAPI#list_asm_exclusion_filters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a ASM Exclusion filter. + # + # @see #update_asm_exclusion_filter_with_http_info + def update_asm_exclusion_filter(exclusion_filter_id, body, opts = {}) + data, _status_code, _headers = update_asm_exclusion_filter_with_http_info(exclusion_filter_id, body, opts) + data + end + + # Update a ASM Exclusion filter. + # + # Update a specific Exclusion filter. + # Returns the Exclusion filter object when the request is successful. + # + # @param exclusion_filter_id [String] The ID of the exclusion filter. + # @param body [ASMExclusionFilterUpdateRequest] New definition of the Exclusion filter. + # @param opts [Hash] the optional parameters + # @return [Array<(ASMExclusionFilterResponse, Integer, Hash)>] ASMExclusionFilterResponse data, response status code and response headers + def update_asm_exclusion_filter_with_http_info(exclusion_filter_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ASMExclusionFiltersAPI.update_asm_exclusion_filter ...' + end + # verify the required parameter 'exclusion_filter_id' is set + if @api_client.config.client_side_validation && exclusion_filter_id.nil? + fail ArgumentError, "Missing the required parameter 'exclusion_filter_id' when calling ASMExclusionFiltersAPI.update_asm_exclusion_filter" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ASMExclusionFiltersAPI.update_asm_exclusion_filter" + end + # resource path + local_var_path = '/api/v2/remote_config/products/asm/waf/exclusion_filters/{exclusion_filter_id}'.sub('{exclusion_filter_id}', CGI.escape(exclusion_filter_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ASMExclusionFilterResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_asm_exclusion_filter, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ASMExclusionFiltersAPI#update_asm_exclusion_filter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_attributes.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_attributes.rb new file mode 100644 index 000000000000..8e6f49bb94a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_attributes.rb @@ -0,0 +1,171 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of the ASM WAF exclusion filter. + class ASMExclusionFilterAttributes + include BaseGenericModel + + # A description for the exclusion filter. + attr_accessor :description + + # Indicates whether the exclusion filter is enabled. + attr_accessor :enabled + + # The IPs list for the exclusion filter. + attr_accessor :ip_list + + # Metadata about the exclusion filter. + attr_accessor :metadata + + # The path glob for the exclusion filter. + attr_accessor :path_glob + + # A list of rules targeted by the exclusion filter. + attr_accessor :rules_target + + # The scope of the exclusion filter. + attr_accessor :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'enabled' => :'enabled', + :'ip_list' => :'ip_list', + :'metadata' => :'metadata', + :'path_glob' => :'path_glob', + :'rules_target' => :'rules_target', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'enabled' => :'Boolean', + :'ip_list' => :'Array', + :'metadata' => :'ASMExclusionFilterMetadata', + :'path_glob' => :'String', + :'rules_target' => :'Array', + :'scope' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'ip_list') + if (value = attributes[:'ip_list']).is_a?(Array) + self.ip_list = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'path_glob') + self.path_glob = attributes[:'path_glob'] + end + + if attributes.key?(:'rules_target') + if (value = attributes[:'rules_target']).is_a?(Array) + self.rules_target = value + end + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + enabled == o.enabled && + ip_list == o.ip_list && + metadata == o.metadata && + path_glob == o.path_glob && + rules_target == o.rules_target && + scope == o.scope + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, enabled, ip_list, metadata, path_glob, rules_target, scope].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_attributes.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_attributes.rb new file mode 100644 index 000000000000..b81ef9fd768d --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_attributes.rb @@ -0,0 +1,190 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Create a new ASM WAF exclusion filter. + class ASMExclusionFilterCreateAttributes + include BaseGenericModel + + # A description for the exclusion filter. + attr_reader :description + + # Indicates whether the exclusion filter is enabled. + attr_reader :enabled + + # The IPs list for the exclusion filter. + attr_accessor :ip_list + + # The path glob for the exclusion filter. + attr_accessor :path_glob + + # A list of rules targeted by the exclusion filter. + attr_accessor :rules_target + + # The scope of the exclusion filter. + attr_accessor :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'enabled' => :'enabled', + :'ip_list' => :'ip_list', + :'path_glob' => :'path_glob', + :'rules_target' => :'rules_target', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'enabled' => :'Boolean', + :'ip_list' => :'Array', + :'path_glob' => :'String', + :'rules_target' => :'Array', + :'scope' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'ip_list') + if (value = attributes[:'ip_list']).is_a?(Array) + self.ip_list = value + end + end + + if attributes.key?(:'path_glob') + self.path_glob = attributes[:'path_glob'] + end + + if attributes.key?(:'rules_target') + if (value = attributes[:'rules_target']).is_a?(Array) + self.rules_target = value + end + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @enabled.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + enabled == o.enabled && + ip_list == o.ip_list && + path_glob == o.path_glob && + rules_target == o.rules_target && + scope == o.scope + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, enabled, ip_list, path_glob, rules_target, scope].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_data.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_data.rb new file mode 100644 index 000000000000..9949851b5994 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object for a single exclusion filter. + class ASMExclusionFilterCreateData + include BaseGenericModel + + # Create a new ASM WAF exclusion filter. + attr_reader :attributes + + # The type of the resource. The value should always be `exclusion_filter`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ASMExclusionFilterCreateAttributes', + :'type' => :'ASMExclusionFilterType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_request.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_request.rb new file mode 100644 index 000000000000..213cf3fb54e7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object that includes the exclusion filter to create. + class ASMExclusionFilterCreateRequest + include BaseGenericModel + + # Object for a single exclusion filter. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ASMExclusionFilterCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_data.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_data.rb new file mode 100644 index 000000000000..a2856b278ca7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object for a single Exclusion filter. + class ASMExclusionFilterData + include BaseGenericModel + + # The attributes of the ASM WAF exclusion filter. + attr_accessor :attributes + + # The ID of the Exclusion filter. + attr_accessor :id + + # The type of the resource. The value should always be `exclusion_filter`. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ASMExclusionFilterAttributes', + :'id' => :'String', + :'type' => :'ASMExclusionFilterType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_attributes.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_attributes.rb new file mode 100644 index 000000000000..03e2c0c5c48f --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_attributes.rb @@ -0,0 +1,171 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of the ASM WAF exclusion filter. + class ASMExclusionFilterListAttributes + include BaseGenericModel + + # A description for the exclusion filter. + attr_accessor :description + + # Indicates whether the exclusion filter is enabled. + attr_accessor :enabled + + # The IPs list for the exclusion filter. + attr_accessor :ip_list + + # Metadata about the exclusion filter. + attr_accessor :metadata + + # The path glob for the exclusion filter. + attr_accessor :path_glob + + # A list of rules targeted by the exclusion filter. + attr_accessor :rules_target + + # The scope of the exclusion filter. + attr_accessor :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'enabled' => :'enabled', + :'ip_list' => :'ip_list', + :'metadata' => :'metadata', + :'path_glob' => :'path_glob', + :'rules_target' => :'rules_target', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'enabled' => :'Boolean', + :'ip_list' => :'Array', + :'metadata' => :'ASMExclusionFilterMetadata', + :'path_glob' => :'String', + :'rules_target' => :'Array', + :'scope' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterListAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'ip_list') + if (value = attributes[:'ip_list']).is_a?(Array) + self.ip_list = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'path_glob') + self.path_glob = attributes[:'path_glob'] + end + + if attributes.key?(:'rules_target') + if (value = attributes[:'rules_target']).is_a?(Array) + self.rules_target = value + end + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + enabled == o.enabled && + ip_list == o.ip_list && + metadata == o.metadata && + path_glob == o.path_glob && + rules_target == o.rules_target && + scope == o.scope + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, enabled, ip_list, metadata, path_glob, rules_target, scope].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_response.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_response.rb new file mode 100644 index 000000000000..76d7d1cbcadb --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_response.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object that includes a list of exclusion filters. + class ASMExclusionFilterListResponse + include BaseGenericModel + + # The ASMExclusionFilterResponse data. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target.rb new file mode 100644 index 000000000000..d30222daabf8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A rule targeted by the exclusion filter. + class ASMExclusionFilterListRulesTarget + include BaseGenericModel + + # Tags identifying the category and type of the targeted rule. + attr_accessor :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'tags' => :'ASMExclusionFilterListRulesTargetTags' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterListRulesTarget` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + tags == o.tags + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [tags].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target_tags.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target_tags.rb new file mode 100644 index 000000000000..9a3051e87b55 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_list_rules_target_tags.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Tags identifying the category and type of the targeted rule. + class ASMExclusionFilterListRulesTargetTags + include BaseGenericModel + + # The category of the rule. + attr_accessor :category + + # The type of the rule. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterListRulesTargetTags` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_metadata.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_metadata.rb new file mode 100644 index 000000000000..4a4769754e67 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_metadata.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata about the exclusion filter. + class ASMExclusionFilterMetadata + include BaseGenericModel + + # The timestamp when the exclusion filter was added. + attr_accessor :added_at + + # The email address of the user who added the exclusion filter. + attr_accessor :added_by + + # The timestamp when the exclusion filter was last modified. + attr_accessor :modified_at + + # The email address of the user who last modified the exclusion filter. + attr_accessor :modified_by + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'added_at' => :'added_at', + :'added_by' => :'added_by', + :'modified_at' => :'modified_at', + :'modified_by' => :'modified_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'added_at' => :'Time', + :'added_by' => :'String', + :'modified_at' => :'Time', + :'modified_by' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterMetadata` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'added_at') + self.added_at = attributes[:'added_at'] + end + + if attributes.key?(:'added_by') + self.added_by = attributes[:'added_by'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'modified_by') + self.modified_by = attributes[:'modified_by'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + added_at == o.added_at && + added_by == o.added_by && + modified_at == o.modified_at && + modified_by == o.modified_by + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [added_at, added_by, modified_at, modified_by].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_response.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_response.rb new file mode 100644 index 000000000000..f5e3bc60da24 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_response.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object that includes a list of exclusion filters. + class ASMExclusionFilterResponse + include BaseGenericModel + + # The ASMExclusionFilterResponse data. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_rules_target.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_rules_target.rb new file mode 100644 index 000000000000..2eb43cc69470 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_rules_target.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A rule targeted by the exclusion filter. + class ASMExclusionFilterRulesTarget + include BaseGenericModel + + # The ID of the targeted rule. + attr_accessor :rule_id + + # The name of the targeted rule. + attr_accessor :rule_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'rule_id' => :'rule_id', + :'rule_name' => :'rule_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'rule_id' => :'String', + :'rule_name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterRulesTarget` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'rule_id') + self.rule_id = attributes[:'rule_id'] + end + + if attributes.key?(:'rule_name') + self.rule_name = attributes[:'rule_name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rule_id == o.rule_id && + rule_name == o.rule_name + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [rule_id, rule_name].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_scope.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_scope.rb new file mode 100644 index 000000000000..5545444ead78 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_scope.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The scope of the exclusion filter. + class ASMExclusionFilterScope + include BaseGenericModel + + # The environment scope for the exclusion filter. + attr_accessor :env + + # The service scope for the exclusion filter. + attr_accessor :service + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'env' => :'env', + :'service' => :'service' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'env' => :'String', + :'service' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterScope` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'env') + self.env = attributes[:'env'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + env == o.env && + service == o.service + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [env, service].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_type.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_type.rb new file mode 100644 index 000000000000..ccd69b26756d --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the resource. The value should always be `exclusion_filter`. + class ASMExclusionFilterType + include BaseEnumModel + + EXCLUSION_FILTER = "exclusion_filter".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_attributes.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_attributes.rb new file mode 100644 index 000000000000..bd0c54808be5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_attributes.rb @@ -0,0 +1,190 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Update an existing ASM Exclusion filter. + class ASMExclusionFilterUpdateAttributes + include BaseGenericModel + + # The description of the Exclusion filter. + attr_reader :description + + # Whether the Exclusion filter is enabled. + attr_reader :enabled + + # The IPs list for the exclusion filter. + attr_accessor :ip_list + + # The path glob for the exclusion filter. + attr_accessor :path_glob + + # A list of rules targeted by the exclusion filter. + attr_accessor :rules_target + + # The scope of the exclusion filter. + attr_accessor :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'enabled' => :'enabled', + :'ip_list' => :'ip_list', + :'path_glob' => :'path_glob', + :'rules_target' => :'rules_target', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'enabled' => :'Boolean', + :'ip_list' => :'Array', + :'path_glob' => :'String', + :'rules_target' => :'Array', + :'scope' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'ip_list') + if (value = attributes[:'ip_list']).is_a?(Array) + self.ip_list = value + end + end + + if attributes.key?(:'path_glob') + self.path_glob = attributes[:'path_glob'] + end + + if attributes.key?(:'rules_target') + if (value = attributes[:'rules_target']).is_a?(Array) + self.rules_target = value + end + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @enabled.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + enabled == o.enabled && + ip_list == o.ip_list && + path_glob == o.path_glob && + rules_target == o.rules_target && + scope == o.scope + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, enabled, ip_list, path_glob, rules_target, scope].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_data.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_data.rb new file mode 100644 index 000000000000..4b428f6d4320 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object for a single Exclusion filter. + class ASMExclusionFilterUpdateData + include BaseGenericModel + + # Update an existing ASM Exclusion filter. + attr_reader :attributes + + # The ID of the exclusion filter. + attr_accessor :id + + # The type of the resource. The value should always be `exclusion_filter`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ASMExclusionFilterUpdateAttributes', + :'id' => :'String', + :'type' => :'ASMExclusionFilterType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_request.rb b/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_request.rb new file mode 100644 index 000000000000..c49e52cf4399 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_filter_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object that includes the Exclusion filter with the attributes to update. + class ASMExclusionFilterUpdateRequest + include BaseGenericModel + + # Object for a single Exclusion filter. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ASMExclusionFilterUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionFilterUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/asm_exclusion_list_filter_data.rb b/lib/datadog_api_client/v2/models/asm_exclusion_list_filter_data.rb new file mode 100644 index 000000000000..bcebdf95c1c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/asm_exclusion_list_filter_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object for a single Exclusion filter. + class ASMExclusionListFilterData + include BaseGenericModel + + # The attributes of the ASM WAF exclusion filter. + attr_accessor :attributes + + # The ID of the Exclusion filter. + attr_accessor :id + + # The type of the resource. The value should always be `exclusion_filter`. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ASMExclusionFilterListAttributes', + :'id' => :'String', + :'type' => :'ASMExclusionFilterType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ASMExclusionListFilterData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end