|
| 1 | +# Create Custom Rule Revision returns "Successfully created" response |
| 2 | + |
| 3 | +require "datadog_api_client" |
| 4 | +DatadogAPIClient.configure do |config| |
| 5 | + config.unstable_operations["v2.create_custom_rule_revision".to_sym] = true |
| 6 | +end |
| 7 | +api_instance = DatadogAPIClient::V2::StaticAnalysisAPI.new |
| 8 | + |
| 9 | +body = DatadogAPIClient::V2::CustomRuleRevisionRequest.new({ |
| 10 | + data: DatadogAPIClient::V2::CustomRuleRevisionRequestData.new({ |
| 11 | + attributes: DatadogAPIClient::V2::CustomRuleRevisionInputAttributes.new({ |
| 12 | + arguments: [ |
| 13 | + DatadogAPIClient::V2::Argument.new({ |
| 14 | + description: "YXJndW1lbnQgZGVzY3JpcHRpb24=", |
| 15 | + name: "YXJndW1lbnRfbmFtZQ==", |
| 16 | + }), |
| 17 | + ], |
| 18 | + category: DatadogAPIClient::V2::CustomRuleRevisionAttributesCategory::SECURITY, |
| 19 | + code: "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", |
| 20 | + creation_message: "Initial revision", |
| 21 | + cve: "CVE-2024-1234", |
| 22 | + cwe: "CWE-79", |
| 23 | + description: "bG9uZyBkZXNjcmlwdGlvbg==", |
| 24 | + documentation_url: "https://docs.example.com/rules/my-rule", |
| 25 | + is_published: false, |
| 26 | + is_testing: false, |
| 27 | + language: DatadogAPIClient::V2::Language::PYTHON, |
| 28 | + severity: DatadogAPIClient::V2::CustomRuleRevisionAttributesSeverity::ERROR, |
| 29 | + short_description: "c2hvcnQgZGVzY3JpcHRpb24=", |
| 30 | + should_use_ai_fix: false, |
| 31 | + tags: [ |
| 32 | + "security", |
| 33 | + "custom", |
| 34 | + ], |
| 35 | + tests: [ |
| 36 | + DatadogAPIClient::V2::CustomRuleRevisionTest.new({ |
| 37 | + annotation_count: 1, |
| 38 | + code: "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", |
| 39 | + filename: "test.yaml", |
| 40 | + }), |
| 41 | + ], |
| 42 | + tree_sitter_query: "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", |
| 43 | + }), |
| 44 | + type: DatadogAPIClient::V2::CustomRuleRevisionDataType::CUSTOM_RULE_REVISION, |
| 45 | + }), |
| 46 | +}) |
| 47 | +p api_instance.create_custom_rule_revision("ruleset_name", "rule_name", body) |
0 commit comments