From 9c6e7e75413573c8d851c74c6bc5c9cce0359c23 Mon Sep 17 00:00:00 2001 From: PatrickMenoti Date: Mon, 16 Oct 2023 15:07:00 +0000 Subject: [PATCH] Auto-Generated SDK --- edgefirewall/.openapi-generator/FILES | 51 +- edgefirewall/README.md | 19 +- edgefirewall/api/openapi.yaml | 387 +++++------- edgefirewall/docs/Behaviors.md | 9 +- edgefirewall/docs/NullArgumentBehavior.md | 23 + edgefirewall/docs/SetCustomResponse.md | 22 + .../docs/SetCustomResponseArgument.md | 15 + .../SetCustomResponseArgumentStatusCode.md | 12 + edgefirewall/docs/SetRateLimitBehavior.md | 22 + .../docs/SetRateLimitBehaviorArgument.md | 34 + ...teLimitBehaviorArgumentAverageRateLimit.md | 12 + .../docs/SetWAFRuleSetAndWafModeBehavior.md | 22 + ...SetWAFRuleSetAndWafModeBehaviorArgument.md | 23 + edgefirewall/docs/SetWAFRuleSetBehavior.md | 22 + .../docs/SetWAFRuleSetBehaviorArgument.md | 23 + edgefirewall/docs/SimpleArgumentBehavior.md | 23 + .../docs/SimpleArgumentBehaviorArgument.md | 12 + .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/JSON.java | 17 +- .../java/org/openapitools/client/Pair.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../openapitools/client/model/Behaviors.java | 587 ++++++++++++------ .../model/CreateEdgeFirewallRequest.java | 2 +- .../client/model/CreateRuleSetRequest.java | 2 +- .../client/model/EdgeFirewall.java | 2 +- .../client/model/EdgeFirewallResponse.java | 2 +- .../org/openapitools/client/model/Links.java | 2 +- .../model/ListEdgeFirewallResponse.java | 2 +- .../client/model/NullArgumentBehavior.java | 295 +++++++++ .../client/model/RuleSetResponse.java | 2 +- .../client/model/RuleSetResponseAll.java | 2 +- .../client/model/RuleSetResult.java | 2 +- .../client/model/RuleSetResultAll.java | 2 +- .../client/model/RuleSetResultResults.java | 2 +- .../model/SSLVerificationStatusCriteria.java | 2 +- .../client/model/SetCustomResponse.java | 286 +++++++++ .../model/SetCustomResponseArgument.java | 280 +++++++++ .../SetCustomResponseArgumentStatusCode.java | 277 +++++++++ .../client/model/SetRateLimitBehavior.java | 286 +++++++++ .../model/SetRateLimitBehaviorArgument.java | 398 ++++++++++++ ...LimitBehaviorArgumentAverageRateLimit.java | 277 +++++++++ .../SetWAFRuleSetAndWafModeBehavior.java | 286 +++++++++ ...tWAFRuleSetAndWafModeBehaviorArgument.java | 293 +++++++++ .../client/model/SetWAFRuleSetBehavior.java | 286 +++++++++ .../model/SetWAFRuleSetBehaviorArgument.java | 284 +++++++++ .../client/model/SimpleArgumentBehavior.java | 288 +++++++++ .../model/SimpleArgumentBehaviorArgument.java | 278 +++++++++ .../model/UpdateEdgeFirewallRequest.java | 2 +- .../model/NullArgumentBehaviorTest.java | 57 ++ ...tCustomResponseArgumentStatusCodeTest.java | 33 + .../model/SetCustomResponseArgumentTest.java | 65 ++ .../client/model/SetCustomResponseTest.java | 57 ++ ...tBehaviorArgumentAverageRateLimitTest.java | 33 + .../SetRateLimitBehaviorArgumentTest.java | 73 +++ .../model/SetRateLimitBehaviorTest.java | 57 ++ ...RuleSetAndWafModeBehaviorArgumentTest.java | 56 ++ .../SetWAFRuleSetAndWafModeBehaviorTest.java | 57 ++ .../SetWAFRuleSetBehaviorArgumentTest.java | 56 ++ .../model/SetWAFRuleSetBehaviorTest.java | 57 ++ .../SimpleArgumentBehaviorArgumentTest.java | 34 + .../model/SimpleArgumentBehaviorTest.java | 57 ++ 65 files changed, 5381 insertions(+), 500 deletions(-) create mode 100644 edgefirewall/docs/NullArgumentBehavior.md create mode 100644 edgefirewall/docs/SetCustomResponse.md create mode 100644 edgefirewall/docs/SetCustomResponseArgument.md create mode 100644 edgefirewall/docs/SetCustomResponseArgumentStatusCode.md create mode 100644 edgefirewall/docs/SetRateLimitBehavior.md create mode 100644 edgefirewall/docs/SetRateLimitBehaviorArgument.md create mode 100644 edgefirewall/docs/SetRateLimitBehaviorArgumentAverageRateLimit.md create mode 100644 edgefirewall/docs/SetWAFRuleSetAndWafModeBehavior.md create mode 100644 edgefirewall/docs/SetWAFRuleSetAndWafModeBehaviorArgument.md create mode 100644 edgefirewall/docs/SetWAFRuleSetBehavior.md create mode 100644 edgefirewall/docs/SetWAFRuleSetBehaviorArgument.md create mode 100644 edgefirewall/docs/SimpleArgumentBehavior.md create mode 100644 edgefirewall/docs/SimpleArgumentBehaviorArgument.md create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/NullArgumentBehavior.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponse.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgument.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCode.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehavior.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgument.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimit.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehavior.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgument.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehavior.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgument.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehavior.java create mode 100644 edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehaviorArgument.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/NullArgumentBehaviorTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCodeTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimitTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgumentTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgumentTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorArgumentTest.java create mode 100644 edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorTest.java diff --git a/edgefirewall/.openapi-generator/FILES b/edgefirewall/.openapi-generator/FILES index 63aa3e8..fd7d4f3 100644 --- a/edgefirewall/.openapi-generator/FILES +++ b/edgefirewall/.openapi-generator/FILES @@ -6,16 +6,15 @@ api/openapi.yaml build.gradle build.sbt docs/Behaviors.md -docs/BehaviorsArgument.md docs/Conditionals.md docs/CreateEdgeFirewallRequest.md docs/CreateRuleSetRequest.md docs/DefaultApi.md docs/EdgeFirewall.md docs/EdgeFirewallResponse.md -docs/GenericBehaviorDetails.md docs/Links.md docs/ListEdgeFirewallResponse.md +docs/NullArgumentBehavior.md docs/RuleSetResponse.md docs/RuleSetResponseAll.md docs/RuleSetResult.md @@ -24,8 +23,18 @@ docs/RuleSetResultResults.md docs/SSLVerificationStatusArguments.md docs/SSLVerificationStatusCriteria.md docs/SSLVerificationStatusOperators.md -docs/SetRateLimitDetails.md -docs/SetWAFRuleSetDetails.md +docs/SetCustomResponse.md +docs/SetCustomResponseArgument.md +docs/SetCustomResponseArgumentStatusCode.md +docs/SetRateLimitBehavior.md +docs/SetRateLimitBehaviorArgument.md +docs/SetRateLimitBehaviorArgumentAverageRateLimit.md +docs/SetWAFRuleSetAndWafModeBehavior.md +docs/SetWAFRuleSetAndWafModeBehaviorArgument.md +docs/SetWAFRuleSetBehavior.md +docs/SetWAFRuleSetBehaviorArgument.md +docs/SimpleArgumentBehavior.md +docs/SimpleArgumentBehaviorArgument.md docs/UpdateEdgeFirewallRequest.md docs/Variables.md git_push.sh @@ -57,15 +66,14 @@ src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/Behaviors.java -src/main/java/org/openapitools/client/model/BehaviorsArgument.java src/main/java/org/openapitools/client/model/Conditionals.java src/main/java/org/openapitools/client/model/CreateEdgeFirewallRequest.java src/main/java/org/openapitools/client/model/CreateRuleSetRequest.java src/main/java/org/openapitools/client/model/EdgeFirewall.java src/main/java/org/openapitools/client/model/EdgeFirewallResponse.java -src/main/java/org/openapitools/client/model/GenericBehaviorDetails.java src/main/java/org/openapitools/client/model/Links.java src/main/java/org/openapitools/client/model/ListEdgeFirewallResponse.java +src/main/java/org/openapitools/client/model/NullArgumentBehavior.java src/main/java/org/openapitools/client/model/RuleSetResponse.java src/main/java/org/openapitools/client/model/RuleSetResponseAll.java src/main/java/org/openapitools/client/model/RuleSetResult.java @@ -74,11 +82,30 @@ src/main/java/org/openapitools/client/model/RuleSetResultResults.java src/main/java/org/openapitools/client/model/SSLVerificationStatusArguments.java src/main/java/org/openapitools/client/model/SSLVerificationStatusCriteria.java src/main/java/org/openapitools/client/model/SSLVerificationStatusOperators.java -src/main/java/org/openapitools/client/model/SetRateLimitDetails.java -src/main/java/org/openapitools/client/model/SetWAFRuleSetDetails.java +src/main/java/org/openapitools/client/model/SetCustomResponse.java +src/main/java/org/openapitools/client/model/SetCustomResponseArgument.java +src/main/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCode.java +src/main/java/org/openapitools/client/model/SetRateLimitBehavior.java +src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgument.java +src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimit.java +src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehavior.java +src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgument.java +src/main/java/org/openapitools/client/model/SetWAFRuleSetBehavior.java +src/main/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgument.java +src/main/java/org/openapitools/client/model/SimpleArgumentBehavior.java +src/main/java/org/openapitools/client/model/SimpleArgumentBehaviorArgument.java src/main/java/org/openapitools/client/model/UpdateEdgeFirewallRequest.java src/main/java/org/openapitools/client/model/Variables.java -src/test/java/org/openapitools/client/model/BehaviorsArgumentTest.java -src/test/java/org/openapitools/client/model/GenericBehaviorDetailsTest.java -src/test/java/org/openapitools/client/model/SetRateLimitDetailsTest.java -src/test/java/org/openapitools/client/model/SetWAFRuleSetDetailsTest.java +src/test/java/org/openapitools/client/model/NullArgumentBehaviorTest.java +src/test/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCodeTest.java +src/test/java/org/openapitools/client/model/SetCustomResponseArgumentTest.java +src/test/java/org/openapitools/client/model/SetCustomResponseTest.java +src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimitTest.java +src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentTest.java +src/test/java/org/openapitools/client/model/SetRateLimitBehaviorTest.java +src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgumentTest.java +src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorTest.java +src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgumentTest.java +src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorTest.java +src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorArgumentTest.java +src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorTest.java diff --git a/edgefirewall/README.md b/edgefirewall/README.md index 4c42efc..3ff3538 100644 --- a/edgefirewall/README.md +++ b/edgefirewall/README.md @@ -2,7 +2,7 @@ Edge Firewall API - API version: 2.0.0 - - Build date: 2023-10-13T11:40:32.253694Z[GMT] + - Build date: 2023-10-16T15:06:58.871978Z[GMT] No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) @@ -142,15 +142,14 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Behaviors](docs/Behaviors.md) - - [BehaviorsArgument](docs/BehaviorsArgument.md) - [Conditionals](docs/Conditionals.md) - [CreateEdgeFirewallRequest](docs/CreateEdgeFirewallRequest.md) - [CreateRuleSetRequest](docs/CreateRuleSetRequest.md) - [EdgeFirewall](docs/EdgeFirewall.md) - [EdgeFirewallResponse](docs/EdgeFirewallResponse.md) - - [GenericBehaviorDetails](docs/GenericBehaviorDetails.md) - [Links](docs/Links.md) - [ListEdgeFirewallResponse](docs/ListEdgeFirewallResponse.md) + - [NullArgumentBehavior](docs/NullArgumentBehavior.md) - [RuleSetResponse](docs/RuleSetResponse.md) - [RuleSetResponseAll](docs/RuleSetResponseAll.md) - [RuleSetResult](docs/RuleSetResult.md) @@ -159,8 +158,18 @@ Class | Method | HTTP request | Description - [SSLVerificationStatusArguments](docs/SSLVerificationStatusArguments.md) - [SSLVerificationStatusCriteria](docs/SSLVerificationStatusCriteria.md) - [SSLVerificationStatusOperators](docs/SSLVerificationStatusOperators.md) - - [SetRateLimitDetails](docs/SetRateLimitDetails.md) - - [SetWAFRuleSetDetails](docs/SetWAFRuleSetDetails.md) + - [SetCustomResponse](docs/SetCustomResponse.md) + - [SetCustomResponseArgument](docs/SetCustomResponseArgument.md) + - [SetCustomResponseArgumentStatusCode](docs/SetCustomResponseArgumentStatusCode.md) + - [SetRateLimitBehavior](docs/SetRateLimitBehavior.md) + - [SetRateLimitBehaviorArgument](docs/SetRateLimitBehaviorArgument.md) + - [SetRateLimitBehaviorArgumentAverageRateLimit](docs/SetRateLimitBehaviorArgumentAverageRateLimit.md) + - [SetWAFRuleSetAndWafModeBehavior](docs/SetWAFRuleSetAndWafModeBehavior.md) + - [SetWAFRuleSetAndWafModeBehaviorArgument](docs/SetWAFRuleSetAndWafModeBehaviorArgument.md) + - [SetWAFRuleSetBehavior](docs/SetWAFRuleSetBehavior.md) + - [SetWAFRuleSetBehaviorArgument](docs/SetWAFRuleSetBehaviorArgument.md) + - [SimpleArgumentBehavior](docs/SimpleArgumentBehavior.md) + - [SimpleArgumentBehaviorArgument](docs/SimpleArgumentBehaviorArgument.md) - [UpdateEdgeFirewallRequest](docs/UpdateEdgeFirewallRequest.md) - [Variables](docs/Variables.md) diff --git a/edgefirewall/api/openapi.yaml b/edgefirewall/api/openapi.yaml index dcc56ca..e4dd803 100644 --- a/edgefirewall/api/openapi.yaml +++ b/edgefirewall/api/openapi.yaml @@ -707,76 +707,69 @@ components: type: boolean type: object Behaviors: - example: - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + oneOf: + - $ref: '#/components/schemas/NullArgumentBehavior' + - $ref: '#/components/schemas/SimpleArgumentBehavior' + - $ref: '#/components/schemas/SetRateLimitBehavior' + - $ref: '#/components/schemas/SetWAFRuleSetBehavior' + - $ref: '#/components/schemas/SetWAFRuleSetAndWafModeBehavior' + - $ref: '#/components/schemas/SetCustomResponse' + NullArgumentBehavior: properties: name: enum: - deny - drop + type: string + argument: + nullable: true + type: integer + type: object + SetRateLimitBehavior: + properties: + name: + enum: - set_rate_limit - - set_waf_ruleset - - run_function - - tag_event type: string argument: - $ref: '#/components/schemas/Behaviors_argument' + $ref: '#/components/schemas/SetRateLimitBehavior_argument' type: object - GenericBehaviorDetails: + SetWAFRuleSetBehavior: properties: name: + enum: + - set_waf_ruleset type: string + argument: + $ref: '#/components/schemas/SetWAFRuleSetBehavior_argument' type: object - SetRateLimitDetails: - example: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 + SetWAFRuleSetAndWafModeBehavior: properties: - type: + name: enum: - - second - - minute + - set_waf_ruleset_and_waf_mode type: string - limit_by: + argument: + $ref: '#/components/schemas/SetWAFRuleSetAndWafModeBehavior_argument' + type: object + SetCustomResponse: + properties: + name: enum: - - client_ip - - global + - set_custom_response type: string - average_rate_limit: - minimum: 1 - type: integer - maximum_burst_size: - minimum: 1 - type: integer + argument: + $ref: '#/components/schemas/SetCustomResponse_argument' type: object - SetWAFRuleSetDetails: - example: - waf_id: 1 - mode: Blocking + SimpleArgumentBehavior: properties: - waf_id: - minimum: 1 - type: integer - mode: + name: enum: - - Learning - - Blocking + - run_function + - tag_event type: string + argument: + $ref: '#/components/schemas/SimpleArgumentBehavior_argument' type: object Variables: enum: @@ -834,34 +827,8 @@ components: results: is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null @@ -896,34 +863,8 @@ components: example: is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null @@ -982,34 +923,8 @@ components: example: is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null @@ -1048,34 +963,8 @@ components: example: is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null @@ -1139,34 +1028,8 @@ components: results: - is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null @@ -1192,34 +1055,8 @@ components: order: 0 - is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null @@ -1263,43 +1100,97 @@ components: $ref: '#/components/schemas/RuleSetResultAll' type: array type: object - Behaviors_argument: + SetRateLimitBehavior_argument_average_rate_limit: + oneOf: + - minimum: 1 + type: integer + - type: string + SetRateLimitBehavior_argument: + example: + type: second + limit_by: client_ip + average_rate_limit: 100 + maximum_burst_size: 10 + properties: + type: + enum: + - second + - minute + type: string + limit_by: + enum: + - client_ip + - global + type: string + average_rate_limit: + $ref: '#/components/schemas/SetRateLimitBehavior_argument_average_rate_limit' + maximum_burst_size: + $ref: '#/components/schemas/SetRateLimitBehavior_argument_average_rate_limit' + type: object + SetWAFRuleSetBehavior_argument: + example: + waf_id: 1 + mode: blocking + properties: + waf_id: + minimum: 1 + type: integer + mode: + enum: + - learning + - blocking + type: string + type: object + SetWAFRuleSetAndWafModeBehavior_argument: + example: + set_waf_ruleset_and_waf_mode: 1 + waf_mode: blocking + properties: + set_waf_ruleset_and_waf_mode: + minimum: 1 + type: integer + waf_mode: + enum: + - learning + - blocking + type: string + required: + - set_waf_ruleset_and_waf_mode + - waf_mode + type: object + SetCustomResponse_argument_status_code: + oneOf: + - type: string + - maximum: 499 + minimum: 200 + type: integer + SetCustomResponse_argument: + example: + status_code: 200 + content_type: application/json + content_body: "{}" + properties: + status_code: + $ref: '#/components/schemas/SetCustomResponse_argument_status_code' + content_type: + type: string + content_body: + type: string + required: + - content_body + - content_type + - status_code + type: object + SimpleArgumentBehavior_argument: oneOf: - - $ref: '#/components/schemas/GenericBehaviorDetails' - - $ref: '#/components/schemas/SetRateLimitDetails' - - $ref: '#/components/schemas/SetWAFRuleSetDetails' + - type: string + - type: number RuleSetResult_results: example: is_active: true behaviors: - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning - - behavior_example_1: - name: deny - behavior_example_2: - name: set_rate_limit - argument: - type: second - limit_by: client_ip - average_rate_limit: 100 - maximum_burst_size: 10 - behavior_example_3: - name: set_waf_ruleset - argument: - waf_id: 1 - mode: Learning + - null + - null criteria: - - conditional: null variable: null diff --git a/edgefirewall/docs/Behaviors.md b/edgefirewall/docs/Behaviors.md index 11bd425..9aef4a3 100644 --- a/edgefirewall/docs/Behaviors.md +++ b/edgefirewall/docs/Behaviors.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**name** | [**NameEnum**](#NameEnum) | | [optional] | -|**argument** | [**BehaviorsArgument**](BehaviorsArgument.md) | | [optional] | +|**argument** | [**SetCustomResponseArgument**](SetCustomResponseArgument.md) | | [optional] | @@ -16,12 +16,7 @@ | Name | Value | |---- | -----| -| DENY | "deny" | -| DROP | "drop" | -| SET_RATE_LIMIT | "set_rate_limit" | -| SET_WAF_RULESET | "set_waf_ruleset" | -| RUN_FUNCTION | "run_function" | -| TAG_EVENT | "tag_event" | +| SET_CUSTOM_RESPONSE | "set_custom_response" | diff --git a/edgefirewall/docs/NullArgumentBehavior.md b/edgefirewall/docs/NullArgumentBehavior.md new file mode 100644 index 0000000..57794f4 --- /dev/null +++ b/edgefirewall/docs/NullArgumentBehavior.md @@ -0,0 +1,23 @@ + + +# NullArgumentBehavior + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | [**NameEnum**](#NameEnum) | | [optional] | +|**argument** | **Integer** | | [optional] | + + + +## Enum: NameEnum + +| Name | Value | +|---- | -----| +| DENY | "deny" | +| DROP | "drop" | + + + diff --git a/edgefirewall/docs/SetCustomResponse.md b/edgefirewall/docs/SetCustomResponse.md new file mode 100644 index 0000000..7e17cb0 --- /dev/null +++ b/edgefirewall/docs/SetCustomResponse.md @@ -0,0 +1,22 @@ + + +# SetCustomResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | [**NameEnum**](#NameEnum) | | [optional] | +|**argument** | [**SetCustomResponseArgument**](SetCustomResponseArgument.md) | | [optional] | + + + +## Enum: NameEnum + +| Name | Value | +|---- | -----| +| SET_CUSTOM_RESPONSE | "set_custom_response" | + + + diff --git a/edgefirewall/docs/SetCustomResponseArgument.md b/edgefirewall/docs/SetCustomResponseArgument.md new file mode 100644 index 0000000..d9831ec --- /dev/null +++ b/edgefirewall/docs/SetCustomResponseArgument.md @@ -0,0 +1,15 @@ + + +# SetCustomResponseArgument + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**statusCode** | [**SetCustomResponseArgumentStatusCode**](SetCustomResponseArgumentStatusCode.md) | | | +|**contentType** | **String** | | | +|**contentBody** | **String** | | | + + + diff --git a/edgefirewall/docs/SetCustomResponseArgumentStatusCode.md b/edgefirewall/docs/SetCustomResponseArgumentStatusCode.md new file mode 100644 index 0000000..976d86d --- /dev/null +++ b/edgefirewall/docs/SetCustomResponseArgumentStatusCode.md @@ -0,0 +1,12 @@ + + +# SetCustomResponseArgumentStatusCode + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/edgefirewall/docs/SetRateLimitBehavior.md b/edgefirewall/docs/SetRateLimitBehavior.md new file mode 100644 index 0000000..b0092f5 --- /dev/null +++ b/edgefirewall/docs/SetRateLimitBehavior.md @@ -0,0 +1,22 @@ + + +# SetRateLimitBehavior + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | [**NameEnum**](#NameEnum) | | [optional] | +|**argument** | [**SetRateLimitBehaviorArgument**](SetRateLimitBehaviorArgument.md) | | [optional] | + + + +## Enum: NameEnum + +| Name | Value | +|---- | -----| +| SET_RATE_LIMIT | "set_rate_limit" | + + + diff --git a/edgefirewall/docs/SetRateLimitBehaviorArgument.md b/edgefirewall/docs/SetRateLimitBehaviorArgument.md new file mode 100644 index 0000000..0755bb1 --- /dev/null +++ b/edgefirewall/docs/SetRateLimitBehaviorArgument.md @@ -0,0 +1,34 @@ + + +# SetRateLimitBehaviorArgument + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**limitBy** | [**LimitByEnum**](#LimitByEnum) | | [optional] | +|**averageRateLimit** | [**SetRateLimitBehaviorArgumentAverageRateLimit**](SetRateLimitBehaviorArgumentAverageRateLimit.md) | | [optional] | +|**maximumBurstSize** | [**SetRateLimitBehaviorArgumentAverageRateLimit**](SetRateLimitBehaviorArgumentAverageRateLimit.md) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| SECOND | "second" | +| MINUTE | "minute" | + + + +## Enum: LimitByEnum + +| Name | Value | +|---- | -----| +| CLIENT_IP | "client_ip" | +| GLOBAL | "global" | + + + diff --git a/edgefirewall/docs/SetRateLimitBehaviorArgumentAverageRateLimit.md b/edgefirewall/docs/SetRateLimitBehaviorArgumentAverageRateLimit.md new file mode 100644 index 0000000..64fca8b --- /dev/null +++ b/edgefirewall/docs/SetRateLimitBehaviorArgumentAverageRateLimit.md @@ -0,0 +1,12 @@ + + +# SetRateLimitBehaviorArgumentAverageRateLimit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/edgefirewall/docs/SetWAFRuleSetAndWafModeBehavior.md b/edgefirewall/docs/SetWAFRuleSetAndWafModeBehavior.md new file mode 100644 index 0000000..899dafb --- /dev/null +++ b/edgefirewall/docs/SetWAFRuleSetAndWafModeBehavior.md @@ -0,0 +1,22 @@ + + +# SetWAFRuleSetAndWafModeBehavior + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | [**NameEnum**](#NameEnum) | | [optional] | +|**argument** | [**SetWAFRuleSetAndWafModeBehaviorArgument**](SetWAFRuleSetAndWafModeBehaviorArgument.md) | | [optional] | + + + +## Enum: NameEnum + +| Name | Value | +|---- | -----| +| SET_WAF_RULESET_AND_WAF_MODE | "set_waf_ruleset_and_waf_mode" | + + + diff --git a/edgefirewall/docs/SetWAFRuleSetAndWafModeBehaviorArgument.md b/edgefirewall/docs/SetWAFRuleSetAndWafModeBehaviorArgument.md new file mode 100644 index 0000000..98f49f9 --- /dev/null +++ b/edgefirewall/docs/SetWAFRuleSetAndWafModeBehaviorArgument.md @@ -0,0 +1,23 @@ + + +# SetWAFRuleSetAndWafModeBehaviorArgument + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**setWafRulesetAndWafMode** | **Integer** | | | +|**wafMode** | [**WafModeEnum**](#WafModeEnum) | | | + + + +## Enum: WafModeEnum + +| Name | Value | +|---- | -----| +| LEARNING | "learning" | +| BLOCKING | "blocking" | + + + diff --git a/edgefirewall/docs/SetWAFRuleSetBehavior.md b/edgefirewall/docs/SetWAFRuleSetBehavior.md new file mode 100644 index 0000000..04ecde4 --- /dev/null +++ b/edgefirewall/docs/SetWAFRuleSetBehavior.md @@ -0,0 +1,22 @@ + + +# SetWAFRuleSetBehavior + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | [**NameEnum**](#NameEnum) | | [optional] | +|**argument** | [**SetWAFRuleSetBehaviorArgument**](SetWAFRuleSetBehaviorArgument.md) | | [optional] | + + + +## Enum: NameEnum + +| Name | Value | +|---- | -----| +| SET_WAF_RULESET | "set_waf_ruleset" | + + + diff --git a/edgefirewall/docs/SetWAFRuleSetBehaviorArgument.md b/edgefirewall/docs/SetWAFRuleSetBehaviorArgument.md new file mode 100644 index 0000000..cd663e3 --- /dev/null +++ b/edgefirewall/docs/SetWAFRuleSetBehaviorArgument.md @@ -0,0 +1,23 @@ + + +# SetWAFRuleSetBehaviorArgument + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**wafId** | **Integer** | | [optional] | +|**mode** | [**ModeEnum**](#ModeEnum) | | [optional] | + + + +## Enum: ModeEnum + +| Name | Value | +|---- | -----| +| LEARNING | "learning" | +| BLOCKING | "blocking" | + + + diff --git a/edgefirewall/docs/SimpleArgumentBehavior.md b/edgefirewall/docs/SimpleArgumentBehavior.md new file mode 100644 index 0000000..24feb3f --- /dev/null +++ b/edgefirewall/docs/SimpleArgumentBehavior.md @@ -0,0 +1,23 @@ + + +# SimpleArgumentBehavior + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | [**NameEnum**](#NameEnum) | | [optional] | +|**argument** | [**SimpleArgumentBehaviorArgument**](SimpleArgumentBehaviorArgument.md) | | [optional] | + + + +## Enum: NameEnum + +| Name | Value | +|---- | -----| +| RUN_FUNCTION | "run_function" | +| TAG_EVENT | "tag_event" | + + + diff --git a/edgefirewall/docs/SimpleArgumentBehaviorArgument.md b/edgefirewall/docs/SimpleArgumentBehaviorArgument.md new file mode 100644 index 0000000..1cfe56f --- /dev/null +++ b/edgefirewall/docs/SimpleArgumentBehaviorArgument.md @@ -0,0 +1,12 @@ + + +# SimpleArgumentBehaviorArgument + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/edgefirewall/src/main/java/org/openapitools/client/ApiException.java b/edgefirewall/src/main/java/org/openapitools/client/ApiException.java index edaac55..e0cb04b 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/ApiException.java +++ b/edgefirewall/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/edgefirewall/src/main/java/org/openapitools/client/Configuration.java b/edgefirewall/src/main/java/org/openapitools/client/Configuration.java index 9579bca..d725996 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/Configuration.java +++ b/edgefirewall/src/main/java/org/openapitools/client/Configuration.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class Configuration { public static final String VERSION = "2.0.0"; diff --git a/edgefirewall/src/main/java/org/openapitools/client/JSON.java b/edgefirewall/src/main/java/org/openapitools/client/JSON.java index 66e4fa8..6d25e0e 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/JSON.java +++ b/edgefirewall/src/main/java/org/openapitools/client/JSON.java @@ -94,22 +94,31 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Behaviors.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BehaviorsArgument.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateEdgeFirewallRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateRuleSetRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.EdgeFirewall.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.EdgeFirewallResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.GenericBehaviorDetails.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Links.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ListEdgeFirewallResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.NullArgumentBehavior.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RuleSetResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RuleSetResponseAll.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RuleSetResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RuleSetResultAll.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RuleSetResultResults.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SSLVerificationStatusCriteria.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetRateLimitDetails.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetWAFRuleSetDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetCustomResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetCustomResponseArgument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetCustomResponseArgumentStatusCode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetRateLimitBehavior.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetRateLimitBehaviorArgument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetRateLimitBehaviorArgumentAverageRateLimit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetWAFRuleSetAndWafModeBehavior.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetWAFRuleSetAndWafModeBehaviorArgument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetWAFRuleSetBehavior.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SetWAFRuleSetBehaviorArgument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleArgumentBehavior.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleArgumentBehaviorArgument.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateEdgeFirewallRequest.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/edgefirewall/src/main/java/org/openapitools/client/Pair.java b/edgefirewall/src/main/java/org/openapitools/client/Pair.java index 7c6e6df..4a034c6 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/Pair.java +++ b/edgefirewall/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class Pair { private String name = ""; private String value = ""; diff --git a/edgefirewall/src/main/java/org/openapitools/client/StringUtil.java b/edgefirewall/src/main/java/org/openapitools/client/StringUtil.java index 1859e22..6894ee9 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/StringUtil.java +++ b/edgefirewall/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/edgefirewall/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/edgefirewall/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index f9f6537..25e5add 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/edgefirewall/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/edgefirewall/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/edgefirewall/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f2ac674..485190a 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/edgefirewall/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/edgefirewall/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index e40c55d..d96a64b 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -23,7 +23,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/Behaviors.java b/edgefirewall/src/main/java/org/openapitools/client/model/Behaviors.java index 05c7316..a131580 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/Behaviors.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/Behaviors.java @@ -21,198 +21,373 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.BehaviorsArgument; +import org.openapitools.client.model.NullArgumentBehavior; +import org.openapitools.client.model.SetCustomResponse; +import org.openapitools.client.model.SetCustomResponseArgument; +import org.openapitools.client.model.SetRateLimitBehavior; +import org.openapitools.client.model.SetWAFRuleSetAndWafModeBehavior; +import org.openapitools.client.model.SetWAFRuleSetBehavior; +import org.openapitools.client.model.SimpleArgumentBehavior; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; import org.openapitools.client.JSON; -/** - * Behaviors - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") -public class Behaviors { - /** - * Gets or Sets name - */ - @JsonAdapter(NameEnum.Adapter.class) - public enum NameEnum { - DENY("deny"), - - DROP("drop"), - - SET_RATE_LIMIT("set_rate_limit"), - - SET_WAF_RULESET("set_waf_ruleset"), - - RUN_FUNCTION("run_function"), - - TAG_EVENT("tag_event"); - - private String value; - - NameEnum(String value) { - this.value = value; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class Behaviors extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Behaviors.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Behaviors.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Behaviors' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterNullArgumentBehavior = gson.getDelegateAdapter(this, TypeToken.get(NullArgumentBehavior.class)); + final TypeAdapter adapterSimpleArgumentBehavior = gson.getDelegateAdapter(this, TypeToken.get(SimpleArgumentBehavior.class)); + final TypeAdapter adapterSetRateLimitBehavior = gson.getDelegateAdapter(this, TypeToken.get(SetRateLimitBehavior.class)); + final TypeAdapter adapterSetWAFRuleSetBehavior = gson.getDelegateAdapter(this, TypeToken.get(SetWAFRuleSetBehavior.class)); + final TypeAdapter adapterSetWAFRuleSetAndWafModeBehavior = gson.getDelegateAdapter(this, TypeToken.get(SetWAFRuleSetAndWafModeBehavior.class)); + final TypeAdapter adapterSetCustomResponse = gson.getDelegateAdapter(this, TypeToken.get(SetCustomResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Behaviors value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `NullArgumentBehavior` + if (value.getActualInstance() instanceof NullArgumentBehavior) { + JsonElement element = adapterNullArgumentBehavior.toJsonTree((NullArgumentBehavior)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SimpleArgumentBehavior` + if (value.getActualInstance() instanceof SimpleArgumentBehavior) { + JsonElement element = adapterSimpleArgumentBehavior.toJsonTree((SimpleArgumentBehavior)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SetRateLimitBehavior` + if (value.getActualInstance() instanceof SetRateLimitBehavior) { + JsonElement element = adapterSetRateLimitBehavior.toJsonTree((SetRateLimitBehavior)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SetWAFRuleSetBehavior` + if (value.getActualInstance() instanceof SetWAFRuleSetBehavior) { + JsonElement element = adapterSetWAFRuleSetBehavior.toJsonTree((SetWAFRuleSetBehavior)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SetWAFRuleSetAndWafModeBehavior` + if (value.getActualInstance() instanceof SetWAFRuleSetAndWafModeBehavior) { + JsonElement element = adapterSetWAFRuleSetAndWafModeBehavior.toJsonTree((SetWAFRuleSetAndWafModeBehavior)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SetCustomResponse` + if (value.getActualInstance() instanceof SetCustomResponse) { + JsonElement element = adapterSetCustomResponse.toJsonTree((SetCustomResponse)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: NullArgumentBehavior, SetCustomResponse, SetRateLimitBehavior, SetWAFRuleSetAndWafModeBehavior, SetWAFRuleSetBehavior, SimpleArgumentBehavior"); + } + + @Override + public Behaviors read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize NullArgumentBehavior + try { + // validate the JSON object to see if any exception is thrown + NullArgumentBehavior.validateJsonElement(jsonElement); + actualAdapter = adapterNullArgumentBehavior; + match++; + log.log(Level.FINER, "Input data matches schema 'NullArgumentBehavior'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for NullArgumentBehavior failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'NullArgumentBehavior'", e); + } + // deserialize SimpleArgumentBehavior + try { + // validate the JSON object to see if any exception is thrown + SimpleArgumentBehavior.validateJsonElement(jsonElement); + actualAdapter = adapterSimpleArgumentBehavior; + match++; + log.log(Level.FINER, "Input data matches schema 'SimpleArgumentBehavior'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SimpleArgumentBehavior failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SimpleArgumentBehavior'", e); + } + // deserialize SetRateLimitBehavior + try { + // validate the JSON object to see if any exception is thrown + SetRateLimitBehavior.validateJsonElement(jsonElement); + actualAdapter = adapterSetRateLimitBehavior; + match++; + log.log(Level.FINER, "Input data matches schema 'SetRateLimitBehavior'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SetRateLimitBehavior failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SetRateLimitBehavior'", e); + } + // deserialize SetWAFRuleSetBehavior + try { + // validate the JSON object to see if any exception is thrown + SetWAFRuleSetBehavior.validateJsonElement(jsonElement); + actualAdapter = adapterSetWAFRuleSetBehavior; + match++; + log.log(Level.FINER, "Input data matches schema 'SetWAFRuleSetBehavior'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SetWAFRuleSetBehavior failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SetWAFRuleSetBehavior'", e); + } + // deserialize SetWAFRuleSetAndWafModeBehavior + try { + // validate the JSON object to see if any exception is thrown + SetWAFRuleSetAndWafModeBehavior.validateJsonElement(jsonElement); + actualAdapter = adapterSetWAFRuleSetAndWafModeBehavior; + match++; + log.log(Level.FINER, "Input data matches schema 'SetWAFRuleSetAndWafModeBehavior'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SetWAFRuleSetAndWafModeBehavior failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SetWAFRuleSetAndWafModeBehavior'", e); + } + // deserialize SetCustomResponse + try { + // validate the JSON object to see if any exception is thrown + SetCustomResponse.validateJsonElement(jsonElement); + actualAdapter = adapterSetCustomResponse; + match++; + log.log(Level.FINER, "Input data matches schema 'SetCustomResponse'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SetCustomResponse failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SetCustomResponse'", e); + } + + if (match == 1) { + Behaviors ret = new Behaviors(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Behaviors: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } } - public String getValue() { - return value; - } + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); - @Override - public String toString() { - return String.valueOf(value); + public Behaviors() { + super("oneOf", Boolean.FALSE); } - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public Behaviors(NullArgumentBehavior o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public NameEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return NameEnum.fromValue(value); - } + public Behaviors(SetCustomResponse o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - } - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private NameEnum name; + public Behaviors(SetRateLimitBehavior o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } - public static final String SERIALIZED_NAME_ARGUMENT = "argument"; - @SerializedName(SERIALIZED_NAME_ARGUMENT) - private BehaviorsArgument argument; + public Behaviors(SetWAFRuleSetAndWafModeBehavior o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } - public Behaviors() { - } + public Behaviors(SetWAFRuleSetBehavior o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } - public Behaviors name(NameEnum name) { - - this.name = name; - return this; - } + public Behaviors(SimpleArgumentBehavior o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - public NameEnum getName() { - return name; - } + static { + schemas.put("NullArgumentBehavior", NullArgumentBehavior.class); + schemas.put("SimpleArgumentBehavior", SimpleArgumentBehavior.class); + schemas.put("SetRateLimitBehavior", SetRateLimitBehavior.class); + schemas.put("SetWAFRuleSetBehavior", SetWAFRuleSetBehavior.class); + schemas.put("SetWAFRuleSetAndWafModeBehavior", SetWAFRuleSetAndWafModeBehavior.class); + schemas.put("SetCustomResponse", SetCustomResponse.class); + } + @Override + public Map> getSchemas() { + return Behaviors.schemas; + } - public void setName(NameEnum name) { - this.name = name; - } + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * NullArgumentBehavior, SetCustomResponse, SetRateLimitBehavior, SetWAFRuleSetAndWafModeBehavior, SetWAFRuleSetBehavior, SimpleArgumentBehavior + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof NullArgumentBehavior) { + super.setActualInstance(instance); + return; + } + if (instance instanceof SimpleArgumentBehavior) { + super.setActualInstance(instance); + return; + } - public Behaviors argument(BehaviorsArgument argument) { - - this.argument = argument; - return this; - } + if (instance instanceof SetRateLimitBehavior) { + super.setActualInstance(instance); + return; + } - /** - * Get argument - * @return argument - **/ - @javax.annotation.Nullable - public BehaviorsArgument getArgument() { - return argument; - } + if (instance instanceof SetWAFRuleSetBehavior) { + super.setActualInstance(instance); + return; + } + if (instance instanceof SetWAFRuleSetAndWafModeBehavior) { + super.setActualInstance(instance); + return; + } - public void setArgument(BehaviorsArgument argument) { - this.argument = argument; - } + if (instance instanceof SetCustomResponse) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be NullArgumentBehavior, SetCustomResponse, SetRateLimitBehavior, SetWAFRuleSetAndWafModeBehavior, SetWAFRuleSetBehavior, SimpleArgumentBehavior"); + } + /** + * Get the actual instance, which can be the following: + * NullArgumentBehavior, SetCustomResponse, SetRateLimitBehavior, SetWAFRuleSetAndWafModeBehavior, SetWAFRuleSetBehavior, SimpleArgumentBehavior + * + * @return The actual instance (NullArgumentBehavior, SetCustomResponse, SetRateLimitBehavior, SetWAFRuleSetAndWafModeBehavior, SetWAFRuleSetBehavior, SimpleArgumentBehavior) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get the actual instance of `NullArgumentBehavior`. If the actual instance is not `NullArgumentBehavior`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullArgumentBehavior` + * @throws ClassCastException if the instance is not `NullArgumentBehavior` + */ + public NullArgumentBehavior getNullArgumentBehavior() throws ClassCastException { + return (NullArgumentBehavior)super.getActualInstance(); } - if (o == null || getClass() != o.getClass()) { - return false; + /** + * Get the actual instance of `SimpleArgumentBehavior`. If the actual instance is not `SimpleArgumentBehavior`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SimpleArgumentBehavior` + * @throws ClassCastException if the instance is not `SimpleArgumentBehavior` + */ + public SimpleArgumentBehavior getSimpleArgumentBehavior() throws ClassCastException { + return (SimpleArgumentBehavior)super.getActualInstance(); } - Behaviors behaviors = (Behaviors) o; - return Objects.equals(this.name, behaviors.name) && - Objects.equals(this.argument, behaviors.argument); - } - - @Override - public int hashCode() { - return Objects.hash(name, argument); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Behaviors {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + /** + * Get the actual instance of `SetRateLimitBehavior`. If the actual instance is not `SetRateLimitBehavior`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SetRateLimitBehavior` + * @throws ClassCastException if the instance is not `SetRateLimitBehavior` + */ + public SetRateLimitBehavior getSetRateLimitBehavior() throws ClassCastException { + return (SetRateLimitBehavior)super.getActualInstance(); + } + /** + * Get the actual instance of `SetWAFRuleSetBehavior`. If the actual instance is not `SetWAFRuleSetBehavior`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SetWAFRuleSetBehavior` + * @throws ClassCastException if the instance is not `SetWAFRuleSetBehavior` + */ + public SetWAFRuleSetBehavior getSetWAFRuleSetBehavior() throws ClassCastException { + return (SetWAFRuleSetBehavior)super.getActualInstance(); + } + /** + * Get the actual instance of `SetWAFRuleSetAndWafModeBehavior`. If the actual instance is not `SetWAFRuleSetAndWafModeBehavior`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SetWAFRuleSetAndWafModeBehavior` + * @throws ClassCastException if the instance is not `SetWAFRuleSetAndWafModeBehavior` + */ + public SetWAFRuleSetAndWafModeBehavior getSetWAFRuleSetAndWafModeBehavior() throws ClassCastException { + return (SetWAFRuleSetAndWafModeBehavior)super.getActualInstance(); + } + /** + * Get the actual instance of `SetCustomResponse`. If the actual instance is not `SetCustomResponse`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SetCustomResponse` + * @throws ClassCastException if the instance is not `SetCustomResponse` + */ + public SetCustomResponse getSetCustomResponse() throws ClassCastException { + return (SetCustomResponse)super.getActualInstance(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("argument"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } /** * Validates the JSON Element and throws an exception if issues found @@ -221,55 +396,59 @@ private String toIndentedString(Object o) { * @throws IOException if the JSON Element is invalid with respect to Behaviors */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Behaviors.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Behaviors is not found in the empty JSON string", Behaviors.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Behaviors.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Behaviors` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); - } - // validate the optional field `argument` - if (jsonObj.get("argument") != null && !jsonObj.get("argument").isJsonNull()) { - BehaviorsArgument.validateJsonElement(jsonObj.get("argument")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Behaviors.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Behaviors' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Behaviors.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Behaviors value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Behaviors read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with NullArgumentBehavior + try { + NullArgumentBehavior.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for NullArgumentBehavior failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SimpleArgumentBehavior + try { + SimpleArgumentBehavior.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SimpleArgumentBehavior failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SetRateLimitBehavior + try { + SetRateLimitBehavior.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SetRateLimitBehavior failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SetWAFRuleSetBehavior + try { + SetWAFRuleSetBehavior.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SetWAFRuleSetBehavior failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SetWAFRuleSetAndWafModeBehavior + try { + SetWAFRuleSetAndWafModeBehavior.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SetWAFRuleSetAndWafModeBehavior failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SetCustomResponse + try { + SetCustomResponse.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SetCustomResponse failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for Behaviors with oneOf schemas: NullArgumentBehavior, SetCustomResponse, SetRateLimitBehavior, SetWAFRuleSetAndWafModeBehavior, SetWAFRuleSetBehavior, SimpleArgumentBehavior. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/CreateEdgeFirewallRequest.java b/edgefirewall/src/main/java/org/openapitools/client/model/CreateEdgeFirewallRequest.java index 0926023..47abe74 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/CreateEdgeFirewallRequest.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/CreateEdgeFirewallRequest.java @@ -51,7 +51,7 @@ /** * CreateEdgeFirewallRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class CreateEdgeFirewallRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/CreateRuleSetRequest.java b/edgefirewall/src/main/java/org/openapitools/client/model/CreateRuleSetRequest.java index 0799ac7..5031498 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/CreateRuleSetRequest.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/CreateRuleSetRequest.java @@ -53,7 +53,7 @@ /** * CreateRuleSetRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class CreateRuleSetRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewall.java b/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewall.java index 6e02d88..b088742 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewall.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewall.java @@ -51,7 +51,7 @@ /** * EdgeFirewall */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class EdgeFirewall { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewallResponse.java b/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewallResponse.java index 8071237..aac1fa6 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewallResponse.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/EdgeFirewallResponse.java @@ -51,7 +51,7 @@ /** * EdgeFirewallResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class EdgeFirewallResponse { public static final String SERIALIZED_NAME_RESULTS = "results"; @SerializedName(SERIALIZED_NAME_RESULTS) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/Links.java b/edgefirewall/src/main/java/org/openapitools/client/model/Links.java index 4ab4b91..8a5feef 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/Links.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/Links.java @@ -50,7 +50,7 @@ /** * Links */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class Links { public static final String SERIALIZED_NAME_PREVIOUS = "previous"; @SerializedName(SERIALIZED_NAME_PREVIOUS) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/ListEdgeFirewallResponse.java b/edgefirewall/src/main/java/org/openapitools/client/model/ListEdgeFirewallResponse.java index d1ab4a6..86777cb 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/ListEdgeFirewallResponse.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/ListEdgeFirewallResponse.java @@ -53,7 +53,7 @@ /** * ListEdgeFirewallResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class ListEdgeFirewallResponse { public static final String SERIALIZED_NAME_COUNT = "count"; @SerializedName(SERIALIZED_NAME_COUNT) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/NullArgumentBehavior.java b/edgefirewall/src/main/java/org/openapitools/client/model/NullArgumentBehavior.java new file mode 100644 index 0000000..724d7ea --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/NullArgumentBehavior.java @@ -0,0 +1,295 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NullArgumentBehavior + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class NullArgumentBehavior { + /** + * Gets or Sets name + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + DENY("deny"), + + DROP("drop"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private NameEnum name; + + public static final String SERIALIZED_NAME_ARGUMENT = "argument"; + @SerializedName(SERIALIZED_NAME_ARGUMENT) + private Integer argument; + + public NullArgumentBehavior() { + } + + public NullArgumentBehavior name(NameEnum name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + + public void setName(NameEnum name) { + this.name = name; + } + + + public NullArgumentBehavior argument(Integer argument) { + + this.argument = argument; + return this; + } + + /** + * Get argument + * @return argument + **/ + @javax.annotation.Nullable + public Integer getArgument() { + return argument; + } + + + public void setArgument(Integer argument) { + this.argument = argument; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullArgumentBehavior nullArgumentBehavior = (NullArgumentBehavior) o; + return Objects.equals(this.name, nullArgumentBehavior.name) && + Objects.equals(this.argument, nullArgumentBehavior.argument); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, argument); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullArgumentBehavior {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("argument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullArgumentBehavior + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NullArgumentBehavior.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NullArgumentBehavior is not found in the empty JSON string", NullArgumentBehavior.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NullArgumentBehavior.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NullArgumentBehavior` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullArgumentBehavior.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullArgumentBehavior' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NullArgumentBehavior.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullArgumentBehavior value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NullArgumentBehavior read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NullArgumentBehavior given an JSON string + * + * @param jsonString JSON string + * @return An instance of NullArgumentBehavior + * @throws IOException if the JSON string is invalid with respect to NullArgumentBehavior + */ + public static NullArgumentBehavior fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NullArgumentBehavior.class); + } + + /** + * Convert an instance of NullArgumentBehavior to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponse.java b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponse.java index 01b2788..954fdfa 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponse.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponse.java @@ -54,7 +54,7 @@ /** * RuleSetResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class RuleSetResponse { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponseAll.java b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponseAll.java index 04fe484..55cb5c2 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponseAll.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResponseAll.java @@ -53,7 +53,7 @@ /** * RuleSetResponseAll */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class RuleSetResponseAll { public static final String SERIALIZED_NAME_COUNT = "count"; @SerializedName(SERIALIZED_NAME_COUNT) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResult.java b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResult.java index f8ebf91..fab39d8 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResult.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResult.java @@ -50,7 +50,7 @@ /** * RuleSetResult */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class RuleSetResult { public static final String SERIALIZED_NAME_RESULTS = "results"; @SerializedName(SERIALIZED_NAME_RESULTS) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultAll.java b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultAll.java index aa11e43..2ba4830 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultAll.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultAll.java @@ -54,7 +54,7 @@ /** * RuleSetResultAll */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class RuleSetResultAll { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultResults.java b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultResults.java index 147941f..de4f664 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultResults.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/RuleSetResultResults.java @@ -54,7 +54,7 @@ /** * RuleSetResultResults */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class RuleSetResultResults { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SSLVerificationStatusCriteria.java b/edgefirewall/src/main/java/org/openapitools/client/model/SSLVerificationStatusCriteria.java index d129120..67259f9 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/SSLVerificationStatusCriteria.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SSLVerificationStatusCriteria.java @@ -53,7 +53,7 @@ /** * SSLVerificationStatusCriteria */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class SSLVerificationStatusCriteria { public static final String SERIALIZED_NAME_VARIABLE = "variable"; @SerializedName(SERIALIZED_NAME_VARIABLE) diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponse.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponse.java new file mode 100644 index 0000000..c1ef662 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponse.java @@ -0,0 +1,286 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetCustomResponseArgument; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetCustomResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetCustomResponse { + /** + * Gets or Sets name + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + SET_CUSTOM_RESPONSE("set_custom_response"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private NameEnum name; + + public static final String SERIALIZED_NAME_ARGUMENT = "argument"; + @SerializedName(SERIALIZED_NAME_ARGUMENT) + private SetCustomResponseArgument argument; + + public SetCustomResponse() { + } + + public SetCustomResponse name(NameEnum name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + + public void setName(NameEnum name) { + this.name = name; + } + + + public SetCustomResponse argument(SetCustomResponseArgument argument) { + + this.argument = argument; + return this; + } + + /** + * Get argument + * @return argument + **/ + @javax.annotation.Nullable + public SetCustomResponseArgument getArgument() { + return argument; + } + + + public void setArgument(SetCustomResponseArgument argument) { + this.argument = argument; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetCustomResponse setCustomResponse = (SetCustomResponse) o; + return Objects.equals(this.name, setCustomResponse.name) && + Objects.equals(this.argument, setCustomResponse.argument); + } + + @Override + public int hashCode() { + return Objects.hash(name, argument); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetCustomResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("argument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetCustomResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetCustomResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetCustomResponse is not found in the empty JSON string", SetCustomResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetCustomResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetCustomResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `argument` + if (jsonObj.get("argument") != null && !jsonObj.get("argument").isJsonNull()) { + SetCustomResponseArgument.validateJsonElement(jsonObj.get("argument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetCustomResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetCustomResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetCustomResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetCustomResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetCustomResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetCustomResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetCustomResponse + * @throws IOException if the JSON string is invalid with respect to SetCustomResponse + */ + public static SetCustomResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetCustomResponse.class); + } + + /** + * Convert an instance of SetCustomResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgument.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgument.java new file mode 100644 index 0000000..6b0bc22 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgument.java @@ -0,0 +1,280 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetCustomResponseArgumentStatusCode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetCustomResponseArgument + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetCustomResponseArgument { + public static final String SERIALIZED_NAME_STATUS_CODE = "status_code"; + @SerializedName(SERIALIZED_NAME_STATUS_CODE) + private SetCustomResponseArgumentStatusCode statusCode; + + public static final String SERIALIZED_NAME_CONTENT_TYPE = "content_type"; + @SerializedName(SERIALIZED_NAME_CONTENT_TYPE) + private String contentType; + + public static final String SERIALIZED_NAME_CONTENT_BODY = "content_body"; + @SerializedName(SERIALIZED_NAME_CONTENT_BODY) + private String contentBody; + + public SetCustomResponseArgument() { + } + + public SetCustomResponseArgument statusCode(SetCustomResponseArgumentStatusCode statusCode) { + + this.statusCode = statusCode; + return this; + } + + /** + * Get statusCode + * @return statusCode + **/ + @javax.annotation.Nonnull + public SetCustomResponseArgumentStatusCode getStatusCode() { + return statusCode; + } + + + public void setStatusCode(SetCustomResponseArgumentStatusCode statusCode) { + this.statusCode = statusCode; + } + + + public SetCustomResponseArgument contentType(String contentType) { + + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + **/ + @javax.annotation.Nonnull + public String getContentType() { + return contentType; + } + + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + + public SetCustomResponseArgument contentBody(String contentBody) { + + this.contentBody = contentBody; + return this; + } + + /** + * Get contentBody + * @return contentBody + **/ + @javax.annotation.Nonnull + public String getContentBody() { + return contentBody; + } + + + public void setContentBody(String contentBody) { + this.contentBody = contentBody; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetCustomResponseArgument setCustomResponseArgument = (SetCustomResponseArgument) o; + return Objects.equals(this.statusCode, setCustomResponseArgument.statusCode) && + Objects.equals(this.contentType, setCustomResponseArgument.contentType) && + Objects.equals(this.contentBody, setCustomResponseArgument.contentBody); + } + + @Override + public int hashCode() { + return Objects.hash(statusCode, contentType, contentBody); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetCustomResponseArgument {\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" contentBody: ").append(toIndentedString(contentBody)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status_code"); + openapiFields.add("content_type"); + openapiFields.add("content_body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status_code"); + openapiRequiredFields.add("content_type"); + openapiRequiredFields.add("content_body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetCustomResponseArgument + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetCustomResponseArgument.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetCustomResponseArgument is not found in the empty JSON string", SetCustomResponseArgument.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetCustomResponseArgument.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetCustomResponseArgument` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SetCustomResponseArgument.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `status_code` + SetCustomResponseArgumentStatusCode.validateJsonElement(jsonObj.get("status_code")); + if (!jsonObj.get("content_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content_type").toString())); + } + if (!jsonObj.get("content_body").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content_body` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content_body").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetCustomResponseArgument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetCustomResponseArgument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetCustomResponseArgument.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetCustomResponseArgument value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetCustomResponseArgument read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetCustomResponseArgument given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetCustomResponseArgument + * @throws IOException if the JSON string is invalid with respect to SetCustomResponseArgument + */ + public static SetCustomResponseArgument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetCustomResponseArgument.class); + } + + /** + * Convert an instance of SetCustomResponseArgument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCode.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCode.java new file mode 100644 index 0000000..970db90 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCode.java @@ -0,0 +1,277 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetCustomResponseArgumentStatusCode extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SetCustomResponseArgumentStatusCode.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetCustomResponseArgumentStatusCode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetCustomResponseArgumentStatusCode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetCustomResponseArgumentStatusCode value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, String"); + } + + @Override + public SetCustomResponseArgumentStatusCode read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if(!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type String in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if(!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + if (match == 1) { + SetCustomResponseArgumentStatusCode ret = new SetCustomResponseArgumentStatusCode(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for SetCustomResponseArgumentStatusCode: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public SetCustomResponseArgumentStatusCode() { + super("oneOf", Boolean.FALSE); + } + + public SetCustomResponseArgumentStatusCode(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SetCustomResponseArgumentStatusCode(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + schemas.put("Integer", Integer.class); + } + + @Override + public Map> getSchemas() { + return SetCustomResponseArgumentStatusCode.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Integer) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetCustomResponseArgumentStatusCode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with String + try { + if(!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type String in the JSON string but got `%s`", jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with Integer + try { + if(!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for SetCustomResponseArgumentStatusCode with oneOf schemas: Integer, String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of SetCustomResponseArgumentStatusCode given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetCustomResponseArgumentStatusCode + * @throws IOException if the JSON string is invalid with respect to SetCustomResponseArgumentStatusCode + */ + public static SetCustomResponseArgumentStatusCode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetCustomResponseArgumentStatusCode.class); + } + + /** + * Convert an instance of SetCustomResponseArgumentStatusCode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehavior.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehavior.java new file mode 100644 index 0000000..b56ea2f --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehavior.java @@ -0,0 +1,286 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetRateLimitBehaviorArgument; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetRateLimitBehavior + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetRateLimitBehavior { + /** + * Gets or Sets name + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + SET_RATE_LIMIT("set_rate_limit"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private NameEnum name; + + public static final String SERIALIZED_NAME_ARGUMENT = "argument"; + @SerializedName(SERIALIZED_NAME_ARGUMENT) + private SetRateLimitBehaviorArgument argument; + + public SetRateLimitBehavior() { + } + + public SetRateLimitBehavior name(NameEnum name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + + public void setName(NameEnum name) { + this.name = name; + } + + + public SetRateLimitBehavior argument(SetRateLimitBehaviorArgument argument) { + + this.argument = argument; + return this; + } + + /** + * Get argument + * @return argument + **/ + @javax.annotation.Nullable + public SetRateLimitBehaviorArgument getArgument() { + return argument; + } + + + public void setArgument(SetRateLimitBehaviorArgument argument) { + this.argument = argument; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetRateLimitBehavior setRateLimitBehavior = (SetRateLimitBehavior) o; + return Objects.equals(this.name, setRateLimitBehavior.name) && + Objects.equals(this.argument, setRateLimitBehavior.argument); + } + + @Override + public int hashCode() { + return Objects.hash(name, argument); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetRateLimitBehavior {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("argument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetRateLimitBehavior + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetRateLimitBehavior.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetRateLimitBehavior is not found in the empty JSON string", SetRateLimitBehavior.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetRateLimitBehavior.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetRateLimitBehavior` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `argument` + if (jsonObj.get("argument") != null && !jsonObj.get("argument").isJsonNull()) { + SetRateLimitBehaviorArgument.validateJsonElement(jsonObj.get("argument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetRateLimitBehavior.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetRateLimitBehavior' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetRateLimitBehavior.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetRateLimitBehavior value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetRateLimitBehavior read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetRateLimitBehavior given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetRateLimitBehavior + * @throws IOException if the JSON string is invalid with respect to SetRateLimitBehavior + */ + public static SetRateLimitBehavior fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetRateLimitBehavior.class); + } + + /** + * Convert an instance of SetRateLimitBehavior to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgument.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgument.java new file mode 100644 index 0000000..ee61e59 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgument.java @@ -0,0 +1,398 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetRateLimitBehaviorArgumentAverageRateLimit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetRateLimitBehaviorArgument + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetRateLimitBehaviorArgument { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + SECOND("second"), + + MINUTE("minute"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + /** + * Gets or Sets limitBy + */ + @JsonAdapter(LimitByEnum.Adapter.class) + public enum LimitByEnum { + CLIENT_IP("client_ip"), + + GLOBAL("global"); + + private String value; + + LimitByEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LimitByEnum fromValue(String value) { + for (LimitByEnum b : LimitByEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LimitByEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LimitByEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LimitByEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_LIMIT_BY = "limit_by"; + @SerializedName(SERIALIZED_NAME_LIMIT_BY) + private LimitByEnum limitBy; + + public static final String SERIALIZED_NAME_AVERAGE_RATE_LIMIT = "average_rate_limit"; + @SerializedName(SERIALIZED_NAME_AVERAGE_RATE_LIMIT) + private SetRateLimitBehaviorArgumentAverageRateLimit averageRateLimit; + + public static final String SERIALIZED_NAME_MAXIMUM_BURST_SIZE = "maximum_burst_size"; + @SerializedName(SERIALIZED_NAME_MAXIMUM_BURST_SIZE) + private SetRateLimitBehaviorArgumentAverageRateLimit maximumBurstSize; + + public SetRateLimitBehaviorArgument() { + } + + public SetRateLimitBehaviorArgument type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public SetRateLimitBehaviorArgument limitBy(LimitByEnum limitBy) { + + this.limitBy = limitBy; + return this; + } + + /** + * Get limitBy + * @return limitBy + **/ + @javax.annotation.Nullable + public LimitByEnum getLimitBy() { + return limitBy; + } + + + public void setLimitBy(LimitByEnum limitBy) { + this.limitBy = limitBy; + } + + + public SetRateLimitBehaviorArgument averageRateLimit(SetRateLimitBehaviorArgumentAverageRateLimit averageRateLimit) { + + this.averageRateLimit = averageRateLimit; + return this; + } + + /** + * Get averageRateLimit + * @return averageRateLimit + **/ + @javax.annotation.Nullable + public SetRateLimitBehaviorArgumentAverageRateLimit getAverageRateLimit() { + return averageRateLimit; + } + + + public void setAverageRateLimit(SetRateLimitBehaviorArgumentAverageRateLimit averageRateLimit) { + this.averageRateLimit = averageRateLimit; + } + + + public SetRateLimitBehaviorArgument maximumBurstSize(SetRateLimitBehaviorArgumentAverageRateLimit maximumBurstSize) { + + this.maximumBurstSize = maximumBurstSize; + return this; + } + + /** + * Get maximumBurstSize + * @return maximumBurstSize + **/ + @javax.annotation.Nullable + public SetRateLimitBehaviorArgumentAverageRateLimit getMaximumBurstSize() { + return maximumBurstSize; + } + + + public void setMaximumBurstSize(SetRateLimitBehaviorArgumentAverageRateLimit maximumBurstSize) { + this.maximumBurstSize = maximumBurstSize; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetRateLimitBehaviorArgument setRateLimitBehaviorArgument = (SetRateLimitBehaviorArgument) o; + return Objects.equals(this.type, setRateLimitBehaviorArgument.type) && + Objects.equals(this.limitBy, setRateLimitBehaviorArgument.limitBy) && + Objects.equals(this.averageRateLimit, setRateLimitBehaviorArgument.averageRateLimit) && + Objects.equals(this.maximumBurstSize, setRateLimitBehaviorArgument.maximumBurstSize); + } + + @Override + public int hashCode() { + return Objects.hash(type, limitBy, averageRateLimit, maximumBurstSize); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetRateLimitBehaviorArgument {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" limitBy: ").append(toIndentedString(limitBy)).append("\n"); + sb.append(" averageRateLimit: ").append(toIndentedString(averageRateLimit)).append("\n"); + sb.append(" maximumBurstSize: ").append(toIndentedString(maximumBurstSize)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("limit_by"); + openapiFields.add("average_rate_limit"); + openapiFields.add("maximum_burst_size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetRateLimitBehaviorArgument + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetRateLimitBehaviorArgument.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetRateLimitBehaviorArgument is not found in the empty JSON string", SetRateLimitBehaviorArgument.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetRateLimitBehaviorArgument.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetRateLimitBehaviorArgument` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("limit_by") != null && !jsonObj.get("limit_by").isJsonNull()) && !jsonObj.get("limit_by").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `limit_by` to be a primitive type in the JSON string but got `%s`", jsonObj.get("limit_by").toString())); + } + // validate the optional field `average_rate_limit` + if (jsonObj.get("average_rate_limit") != null && !jsonObj.get("average_rate_limit").isJsonNull()) { + SetRateLimitBehaviorArgumentAverageRateLimit.validateJsonElement(jsonObj.get("average_rate_limit")); + } + // validate the optional field `maximum_burst_size` + if (jsonObj.get("maximum_burst_size") != null && !jsonObj.get("maximum_burst_size").isJsonNull()) { + SetRateLimitBehaviorArgumentAverageRateLimit.validateJsonElement(jsonObj.get("maximum_burst_size")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetRateLimitBehaviorArgument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetRateLimitBehaviorArgument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetRateLimitBehaviorArgument.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetRateLimitBehaviorArgument value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetRateLimitBehaviorArgument read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetRateLimitBehaviorArgument given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetRateLimitBehaviorArgument + * @throws IOException if the JSON string is invalid with respect to SetRateLimitBehaviorArgument + */ + public static SetRateLimitBehaviorArgument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetRateLimitBehaviorArgument.class); + } + + /** + * Convert an instance of SetRateLimitBehaviorArgument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimit.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimit.java new file mode 100644 index 0000000..bafb5fd --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimit.java @@ -0,0 +1,277 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetRateLimitBehaviorArgumentAverageRateLimit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SetRateLimitBehaviorArgumentAverageRateLimit.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetRateLimitBehaviorArgumentAverageRateLimit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetRateLimitBehaviorArgumentAverageRateLimit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetRateLimitBehaviorArgumentAverageRateLimit value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, String"); + } + + @Override + public SetRateLimitBehaviorArgumentAverageRateLimit read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if(!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if(!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type String in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + if (match == 1) { + SetRateLimitBehaviorArgumentAverageRateLimit ret = new SetRateLimitBehaviorArgumentAverageRateLimit(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for SetRateLimitBehaviorArgumentAverageRateLimit: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public SetRateLimitBehaviorArgumentAverageRateLimit() { + super("oneOf", Boolean.FALSE); + } + + public SetRateLimitBehaviorArgumentAverageRateLimit(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SetRateLimitBehaviorArgumentAverageRateLimit(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return SetRateLimitBehaviorArgumentAverageRateLimit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Integer) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetRateLimitBehaviorArgumentAverageRateLimit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with Integer + try { + if(!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with String + try { + if(!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type String in the JSON string but got `%s`", jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for SetRateLimitBehaviorArgumentAverageRateLimit with oneOf schemas: Integer, String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of SetRateLimitBehaviorArgumentAverageRateLimit given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetRateLimitBehaviorArgumentAverageRateLimit + * @throws IOException if the JSON string is invalid with respect to SetRateLimitBehaviorArgumentAverageRateLimit + */ + public static SetRateLimitBehaviorArgumentAverageRateLimit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetRateLimitBehaviorArgumentAverageRateLimit.class); + } + + /** + * Convert an instance of SetRateLimitBehaviorArgumentAverageRateLimit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehavior.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehavior.java new file mode 100644 index 0000000..90c48a2 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehavior.java @@ -0,0 +1,286 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetWAFRuleSetAndWafModeBehaviorArgument; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetWAFRuleSetAndWafModeBehavior + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetWAFRuleSetAndWafModeBehavior { + /** + * Gets or Sets name + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + SET_WAF_RULESET_AND_WAF_MODE("set_waf_ruleset_and_waf_mode"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private NameEnum name; + + public static final String SERIALIZED_NAME_ARGUMENT = "argument"; + @SerializedName(SERIALIZED_NAME_ARGUMENT) + private SetWAFRuleSetAndWafModeBehaviorArgument argument; + + public SetWAFRuleSetAndWafModeBehavior() { + } + + public SetWAFRuleSetAndWafModeBehavior name(NameEnum name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + + public void setName(NameEnum name) { + this.name = name; + } + + + public SetWAFRuleSetAndWafModeBehavior argument(SetWAFRuleSetAndWafModeBehaviorArgument argument) { + + this.argument = argument; + return this; + } + + /** + * Get argument + * @return argument + **/ + @javax.annotation.Nullable + public SetWAFRuleSetAndWafModeBehaviorArgument getArgument() { + return argument; + } + + + public void setArgument(SetWAFRuleSetAndWafModeBehaviorArgument argument) { + this.argument = argument; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetWAFRuleSetAndWafModeBehavior setWAFRuleSetAndWafModeBehavior = (SetWAFRuleSetAndWafModeBehavior) o; + return Objects.equals(this.name, setWAFRuleSetAndWafModeBehavior.name) && + Objects.equals(this.argument, setWAFRuleSetAndWafModeBehavior.argument); + } + + @Override + public int hashCode() { + return Objects.hash(name, argument); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetWAFRuleSetAndWafModeBehavior {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("argument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetWAFRuleSetAndWafModeBehavior + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetWAFRuleSetAndWafModeBehavior.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetWAFRuleSetAndWafModeBehavior is not found in the empty JSON string", SetWAFRuleSetAndWafModeBehavior.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetWAFRuleSetAndWafModeBehavior.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetWAFRuleSetAndWafModeBehavior` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `argument` + if (jsonObj.get("argument") != null && !jsonObj.get("argument").isJsonNull()) { + SetWAFRuleSetAndWafModeBehaviorArgument.validateJsonElement(jsonObj.get("argument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetWAFRuleSetAndWafModeBehavior.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetWAFRuleSetAndWafModeBehavior' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetWAFRuleSetAndWafModeBehavior.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetWAFRuleSetAndWafModeBehavior value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetWAFRuleSetAndWafModeBehavior read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetWAFRuleSetAndWafModeBehavior given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetWAFRuleSetAndWafModeBehavior + * @throws IOException if the JSON string is invalid with respect to SetWAFRuleSetAndWafModeBehavior + */ + public static SetWAFRuleSetAndWafModeBehavior fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetWAFRuleSetAndWafModeBehavior.class); + } + + /** + * Convert an instance of SetWAFRuleSetAndWafModeBehavior to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgument.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgument.java new file mode 100644 index 0000000..945e241 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgument.java @@ -0,0 +1,293 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetWAFRuleSetAndWafModeBehaviorArgument + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetWAFRuleSetAndWafModeBehaviorArgument { + public static final String SERIALIZED_NAME_SET_WAF_RULESET_AND_WAF_MODE = "set_waf_ruleset_and_waf_mode"; + @SerializedName(SERIALIZED_NAME_SET_WAF_RULESET_AND_WAF_MODE) + private Integer setWafRulesetAndWafMode; + + /** + * Gets or Sets wafMode + */ + @JsonAdapter(WafModeEnum.Adapter.class) + public enum WafModeEnum { + LEARNING("learning"), + + BLOCKING("blocking"); + + private String value; + + WafModeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static WafModeEnum fromValue(String value) { + for (WafModeEnum b : WafModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final WafModeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public WafModeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return WafModeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_WAF_MODE = "waf_mode"; + @SerializedName(SERIALIZED_NAME_WAF_MODE) + private WafModeEnum wafMode; + + public SetWAFRuleSetAndWafModeBehaviorArgument() { + } + + public SetWAFRuleSetAndWafModeBehaviorArgument setWafRulesetAndWafMode(Integer setWafRulesetAndWafMode) { + + this.setWafRulesetAndWafMode = setWafRulesetAndWafMode; + return this; + } + + /** + * Get setWafRulesetAndWafMode + * minimum: 1 + * @return setWafRulesetAndWafMode + **/ + @javax.annotation.Nonnull + public Integer getSetWafRulesetAndWafMode() { + return setWafRulesetAndWafMode; + } + + + public void setSetWafRulesetAndWafMode(Integer setWafRulesetAndWafMode) { + this.setWafRulesetAndWafMode = setWafRulesetAndWafMode; + } + + + public SetWAFRuleSetAndWafModeBehaviorArgument wafMode(WafModeEnum wafMode) { + + this.wafMode = wafMode; + return this; + } + + /** + * Get wafMode + * @return wafMode + **/ + @javax.annotation.Nonnull + public WafModeEnum getWafMode() { + return wafMode; + } + + + public void setWafMode(WafModeEnum wafMode) { + this.wafMode = wafMode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetWAFRuleSetAndWafModeBehaviorArgument setWAFRuleSetAndWafModeBehaviorArgument = (SetWAFRuleSetAndWafModeBehaviorArgument) o; + return Objects.equals(this.setWafRulesetAndWafMode, setWAFRuleSetAndWafModeBehaviorArgument.setWafRulesetAndWafMode) && + Objects.equals(this.wafMode, setWAFRuleSetAndWafModeBehaviorArgument.wafMode); + } + + @Override + public int hashCode() { + return Objects.hash(setWafRulesetAndWafMode, wafMode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetWAFRuleSetAndWafModeBehaviorArgument {\n"); + sb.append(" setWafRulesetAndWafMode: ").append(toIndentedString(setWafRulesetAndWafMode)).append("\n"); + sb.append(" wafMode: ").append(toIndentedString(wafMode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("set_waf_ruleset_and_waf_mode"); + openapiFields.add("waf_mode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("set_waf_ruleset_and_waf_mode"); + openapiRequiredFields.add("waf_mode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetWAFRuleSetAndWafModeBehaviorArgument + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetWAFRuleSetAndWafModeBehaviorArgument.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetWAFRuleSetAndWafModeBehaviorArgument is not found in the empty JSON string", SetWAFRuleSetAndWafModeBehaviorArgument.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetWAFRuleSetAndWafModeBehaviorArgument.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetWAFRuleSetAndWafModeBehaviorArgument` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SetWAFRuleSetAndWafModeBehaviorArgument.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("waf_mode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waf_mode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waf_mode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetWAFRuleSetAndWafModeBehaviorArgument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetWAFRuleSetAndWafModeBehaviorArgument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetWAFRuleSetAndWafModeBehaviorArgument.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetWAFRuleSetAndWafModeBehaviorArgument value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetWAFRuleSetAndWafModeBehaviorArgument read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetWAFRuleSetAndWafModeBehaviorArgument given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetWAFRuleSetAndWafModeBehaviorArgument + * @throws IOException if the JSON string is invalid with respect to SetWAFRuleSetAndWafModeBehaviorArgument + */ + public static SetWAFRuleSetAndWafModeBehaviorArgument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetWAFRuleSetAndWafModeBehaviorArgument.class); + } + + /** + * Convert an instance of SetWAFRuleSetAndWafModeBehaviorArgument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehavior.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehavior.java new file mode 100644 index 0000000..b9b634d --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehavior.java @@ -0,0 +1,286 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetWAFRuleSetBehaviorArgument; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetWAFRuleSetBehavior + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetWAFRuleSetBehavior { + /** + * Gets or Sets name + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + SET_WAF_RULESET("set_waf_ruleset"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private NameEnum name; + + public static final String SERIALIZED_NAME_ARGUMENT = "argument"; + @SerializedName(SERIALIZED_NAME_ARGUMENT) + private SetWAFRuleSetBehaviorArgument argument; + + public SetWAFRuleSetBehavior() { + } + + public SetWAFRuleSetBehavior name(NameEnum name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + + public void setName(NameEnum name) { + this.name = name; + } + + + public SetWAFRuleSetBehavior argument(SetWAFRuleSetBehaviorArgument argument) { + + this.argument = argument; + return this; + } + + /** + * Get argument + * @return argument + **/ + @javax.annotation.Nullable + public SetWAFRuleSetBehaviorArgument getArgument() { + return argument; + } + + + public void setArgument(SetWAFRuleSetBehaviorArgument argument) { + this.argument = argument; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetWAFRuleSetBehavior setWAFRuleSetBehavior = (SetWAFRuleSetBehavior) o; + return Objects.equals(this.name, setWAFRuleSetBehavior.name) && + Objects.equals(this.argument, setWAFRuleSetBehavior.argument); + } + + @Override + public int hashCode() { + return Objects.hash(name, argument); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetWAFRuleSetBehavior {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("argument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetWAFRuleSetBehavior + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetWAFRuleSetBehavior.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetWAFRuleSetBehavior is not found in the empty JSON string", SetWAFRuleSetBehavior.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetWAFRuleSetBehavior.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetWAFRuleSetBehavior` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `argument` + if (jsonObj.get("argument") != null && !jsonObj.get("argument").isJsonNull()) { + SetWAFRuleSetBehaviorArgument.validateJsonElement(jsonObj.get("argument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetWAFRuleSetBehavior.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetWAFRuleSetBehavior' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetWAFRuleSetBehavior.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetWAFRuleSetBehavior value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetWAFRuleSetBehavior read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetWAFRuleSetBehavior given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetWAFRuleSetBehavior + * @throws IOException if the JSON string is invalid with respect to SetWAFRuleSetBehavior + */ + public static SetWAFRuleSetBehavior fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetWAFRuleSetBehavior.class); + } + + /** + * Convert an instance of SetWAFRuleSetBehavior to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgument.java b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgument.java new file mode 100644 index 0000000..2e6b1a0 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgument.java @@ -0,0 +1,284 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SetWAFRuleSetBehaviorArgument + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SetWAFRuleSetBehaviorArgument { + public static final String SERIALIZED_NAME_WAF_ID = "waf_id"; + @SerializedName(SERIALIZED_NAME_WAF_ID) + private Integer wafId; + + /** + * Gets or Sets mode + */ + @JsonAdapter(ModeEnum.Adapter.class) + public enum ModeEnum { + LEARNING("learning"), + + BLOCKING("blocking"); + + private String value; + + ModeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModeEnum fromValue(String value) { + for (ModeEnum b : ModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ModeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ModeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_MODE = "mode"; + @SerializedName(SERIALIZED_NAME_MODE) + private ModeEnum mode; + + public SetWAFRuleSetBehaviorArgument() { + } + + public SetWAFRuleSetBehaviorArgument wafId(Integer wafId) { + + this.wafId = wafId; + return this; + } + + /** + * Get wafId + * minimum: 1 + * @return wafId + **/ + @javax.annotation.Nullable + public Integer getWafId() { + return wafId; + } + + + public void setWafId(Integer wafId) { + this.wafId = wafId; + } + + + public SetWAFRuleSetBehaviorArgument mode(ModeEnum mode) { + + this.mode = mode; + return this; + } + + /** + * Get mode + * @return mode + **/ + @javax.annotation.Nullable + public ModeEnum getMode() { + return mode; + } + + + public void setMode(ModeEnum mode) { + this.mode = mode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetWAFRuleSetBehaviorArgument setWAFRuleSetBehaviorArgument = (SetWAFRuleSetBehaviorArgument) o; + return Objects.equals(this.wafId, setWAFRuleSetBehaviorArgument.wafId) && + Objects.equals(this.mode, setWAFRuleSetBehaviorArgument.mode); + } + + @Override + public int hashCode() { + return Objects.hash(wafId, mode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetWAFRuleSetBehaviorArgument {\n"); + sb.append(" wafId: ").append(toIndentedString(wafId)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("waf_id"); + openapiFields.add("mode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SetWAFRuleSetBehaviorArgument + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetWAFRuleSetBehaviorArgument.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SetWAFRuleSetBehaviorArgument is not found in the empty JSON string", SetWAFRuleSetBehaviorArgument.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SetWAFRuleSetBehaviorArgument.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SetWAFRuleSetBehaviorArgument` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("mode") != null && !jsonObj.get("mode").isJsonNull()) && !jsonObj.get("mode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetWAFRuleSetBehaviorArgument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetWAFRuleSetBehaviorArgument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SetWAFRuleSetBehaviorArgument.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SetWAFRuleSetBehaviorArgument value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SetWAFRuleSetBehaviorArgument read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SetWAFRuleSetBehaviorArgument given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetWAFRuleSetBehaviorArgument + * @throws IOException if the JSON string is invalid with respect to SetWAFRuleSetBehaviorArgument + */ + public static SetWAFRuleSetBehaviorArgument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetWAFRuleSetBehaviorArgument.class); + } + + /** + * Convert an instance of SetWAFRuleSetBehaviorArgument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehavior.java b/edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehavior.java new file mode 100644 index 0000000..bb61871 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehavior.java @@ -0,0 +1,288 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SimpleArgumentBehaviorArgument; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleArgumentBehavior + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SimpleArgumentBehavior { + /** + * Gets or Sets name + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + RUN_FUNCTION("run_function"), + + TAG_EVENT("tag_event"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private NameEnum name; + + public static final String SERIALIZED_NAME_ARGUMENT = "argument"; + @SerializedName(SERIALIZED_NAME_ARGUMENT) + private SimpleArgumentBehaviorArgument argument; + + public SimpleArgumentBehavior() { + } + + public SimpleArgumentBehavior name(NameEnum name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + + public void setName(NameEnum name) { + this.name = name; + } + + + public SimpleArgumentBehavior argument(SimpleArgumentBehaviorArgument argument) { + + this.argument = argument; + return this; + } + + /** + * Get argument + * @return argument + **/ + @javax.annotation.Nullable + public SimpleArgumentBehaviorArgument getArgument() { + return argument; + } + + + public void setArgument(SimpleArgumentBehaviorArgument argument) { + this.argument = argument; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SimpleArgumentBehavior simpleArgumentBehavior = (SimpleArgumentBehavior) o; + return Objects.equals(this.name, simpleArgumentBehavior.name) && + Objects.equals(this.argument, simpleArgumentBehavior.argument); + } + + @Override + public int hashCode() { + return Objects.hash(name, argument); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimpleArgumentBehavior {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" argument: ").append(toIndentedString(argument)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("argument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleArgumentBehavior + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SimpleArgumentBehavior.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SimpleArgumentBehavior is not found in the empty JSON string", SimpleArgumentBehavior.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SimpleArgumentBehavior.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SimpleArgumentBehavior` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `argument` + if (jsonObj.get("argument") != null && !jsonObj.get("argument").isJsonNull()) { + SimpleArgumentBehaviorArgument.validateJsonElement(jsonObj.get("argument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimpleArgumentBehavior.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleArgumentBehavior' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SimpleArgumentBehavior.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleArgumentBehavior value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SimpleArgumentBehavior read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SimpleArgumentBehavior given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimpleArgumentBehavior + * @throws IOException if the JSON string is invalid with respect to SimpleArgumentBehavior + */ + public static SimpleArgumentBehavior fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimpleArgumentBehavior.class); + } + + /** + * Convert an instance of SimpleArgumentBehavior to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehaviorArgument.java b/edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehaviorArgument.java new file mode 100644 index 0000000..9a3b1f3 --- /dev/null +++ b/edgefirewall/src/main/java/org/openapitools/client/model/SimpleArgumentBehaviorArgument.java @@ -0,0 +1,278 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.math.BigDecimal; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") +public class SimpleArgumentBehaviorArgument extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SimpleArgumentBehaviorArgument.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimpleArgumentBehaviorArgument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleArgumentBehaviorArgument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterBigDecimal = gson.getDelegateAdapter(this, TypeToken.get(BigDecimal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleArgumentBehaviorArgument value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `BigDecimal` + if (value.getActualInstance() instanceof BigDecimal) { + JsonElement element = adapterBigDecimal.toJsonTree((BigDecimal)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: BigDecimal, String"); + } + + @Override + public SimpleArgumentBehaviorArgument read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if(!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type String in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + // deserialize BigDecimal + try { + // validate the JSON object to see if any exception is thrown + if(!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterBigDecimal; + match++; + log.log(Level.FINER, "Input data matches schema 'BigDecimal'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BigDecimal failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + if (match == 1) { + SimpleArgumentBehaviorArgument ret = new SimpleArgumentBehaviorArgument(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for SimpleArgumentBehaviorArgument: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public SimpleArgumentBehaviorArgument() { + super("oneOf", Boolean.FALSE); + } + + public SimpleArgumentBehaviorArgument(BigDecimal o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SimpleArgumentBehaviorArgument(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + schemas.put("BigDecimal", BigDecimal.class); + } + + @Override + public Map> getSchemas() { + return SimpleArgumentBehaviorArgument.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BigDecimal, String + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof BigDecimal) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, String"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, String + * + * @return The actual instance (BigDecimal, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleArgumentBehaviorArgument + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with String + try { + if(!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type String in the JSON string but got `%s`", jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with BigDecimal + try { + if(!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for BigDecimal failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for SimpleArgumentBehaviorArgument with oneOf schemas: BigDecimal, String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of SimpleArgumentBehaviorArgument given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimpleArgumentBehaviorArgument + * @throws IOException if the JSON string is invalid with respect to SimpleArgumentBehaviorArgument + */ + public static SimpleArgumentBehaviorArgument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimpleArgumentBehaviorArgument.class); + } + + /** + * Convert an instance of SimpleArgumentBehaviorArgument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/edgefirewall/src/main/java/org/openapitools/client/model/UpdateEdgeFirewallRequest.java b/edgefirewall/src/main/java/org/openapitools/client/model/UpdateEdgeFirewallRequest.java index cdad49e..3788c86 100644 --- a/edgefirewall/src/main/java/org/openapitools/client/model/UpdateEdgeFirewallRequest.java +++ b/edgefirewall/src/main/java/org/openapitools/client/model/UpdateEdgeFirewallRequest.java @@ -51,7 +51,7 @@ /** * UpdateEdgeFirewallRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-13T11:40:32.253694Z[GMT]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-16T15:06:58.871978Z[GMT]") public class UpdateEdgeFirewallRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/NullArgumentBehaviorTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/NullArgumentBehaviorTest.java new file mode 100644 index 0000000..b2e4d01 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/NullArgumentBehaviorTest.java @@ -0,0 +1,57 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullArgumentBehavior + */ +public class NullArgumentBehaviorTest { + private final NullArgumentBehavior model = new NullArgumentBehavior(); + + /** + * Model tests for NullArgumentBehavior + */ + @Test + public void testNullArgumentBehavior() { + // TODO: test NullArgumentBehavior + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'argument' + */ + @Test + public void argumentTest() { + // TODO: test argument + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCodeTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCodeTest.java new file mode 100644 index 0000000..ef0c86f --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentStatusCodeTest.java @@ -0,0 +1,33 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetCustomResponseArgumentStatusCode + */ +public class SetCustomResponseArgumentStatusCodeTest { + private final SetCustomResponseArgumentStatusCode model = new SetCustomResponseArgumentStatusCode(); + + /** + * Model tests for SetCustomResponseArgumentStatusCode + */ + @Test + public void testSetCustomResponseArgumentStatusCode() { + // TODO: test SetCustomResponseArgumentStatusCode + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentTest.java new file mode 100644 index 0000000..b4f9d7a --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseArgumentTest.java @@ -0,0 +1,65 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetCustomResponseArgumentStatusCode; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetCustomResponseArgument + */ +public class SetCustomResponseArgumentTest { + private final SetCustomResponseArgument model = new SetCustomResponseArgument(); + + /** + * Model tests for SetCustomResponseArgument + */ + @Test + public void testSetCustomResponseArgument() { + // TODO: test SetCustomResponseArgument + } + + /** + * Test the property 'statusCode' + */ + @Test + public void statusCodeTest() { + // TODO: test statusCode + } + + /** + * Test the property 'contentType' + */ + @Test + public void contentTypeTest() { + // TODO: test contentType + } + + /** + * Test the property 'contentBody' + */ + @Test + public void contentBodyTest() { + // TODO: test contentBody + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseTest.java new file mode 100644 index 0000000..dde47ec --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetCustomResponseTest.java @@ -0,0 +1,57 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetCustomResponseArgument; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetCustomResponse + */ +public class SetCustomResponseTest { + private final SetCustomResponse model = new SetCustomResponse(); + + /** + * Model tests for SetCustomResponse + */ + @Test + public void testSetCustomResponse() { + // TODO: test SetCustomResponse + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'argument' + */ + @Test + public void argumentTest() { + // TODO: test argument + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimitTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimitTest.java new file mode 100644 index 0000000..a80ec83 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentAverageRateLimitTest.java @@ -0,0 +1,33 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetRateLimitBehaviorArgumentAverageRateLimit + */ +public class SetRateLimitBehaviorArgumentAverageRateLimitTest { + private final SetRateLimitBehaviorArgumentAverageRateLimit model = new SetRateLimitBehaviorArgumentAverageRateLimit(); + + /** + * Model tests for SetRateLimitBehaviorArgumentAverageRateLimit + */ + @Test + public void testSetRateLimitBehaviorArgumentAverageRateLimit() { + // TODO: test SetRateLimitBehaviorArgumentAverageRateLimit + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentTest.java new file mode 100644 index 0000000..87896ab --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorArgumentTest.java @@ -0,0 +1,73 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetRateLimitBehaviorArgumentAverageRateLimit; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetRateLimitBehaviorArgument + */ +public class SetRateLimitBehaviorArgumentTest { + private final SetRateLimitBehaviorArgument model = new SetRateLimitBehaviorArgument(); + + /** + * Model tests for SetRateLimitBehaviorArgument + */ + @Test + public void testSetRateLimitBehaviorArgument() { + // TODO: test SetRateLimitBehaviorArgument + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'limitBy' + */ + @Test + public void limitByTest() { + // TODO: test limitBy + } + + /** + * Test the property 'averageRateLimit' + */ + @Test + public void averageRateLimitTest() { + // TODO: test averageRateLimit + } + + /** + * Test the property 'maximumBurstSize' + */ + @Test + public void maximumBurstSizeTest() { + // TODO: test maximumBurstSize + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorTest.java new file mode 100644 index 0000000..653d020 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetRateLimitBehaviorTest.java @@ -0,0 +1,57 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetRateLimitBehaviorArgument; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetRateLimitBehavior + */ +public class SetRateLimitBehaviorTest { + private final SetRateLimitBehavior model = new SetRateLimitBehavior(); + + /** + * Model tests for SetRateLimitBehavior + */ + @Test + public void testSetRateLimitBehavior() { + // TODO: test SetRateLimitBehavior + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'argument' + */ + @Test + public void argumentTest() { + // TODO: test argument + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgumentTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgumentTest.java new file mode 100644 index 0000000..533521c --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorArgumentTest.java @@ -0,0 +1,56 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetWAFRuleSetAndWafModeBehaviorArgument + */ +public class SetWAFRuleSetAndWafModeBehaviorArgumentTest { + private final SetWAFRuleSetAndWafModeBehaviorArgument model = new SetWAFRuleSetAndWafModeBehaviorArgument(); + + /** + * Model tests for SetWAFRuleSetAndWafModeBehaviorArgument + */ + @Test + public void testSetWAFRuleSetAndWafModeBehaviorArgument() { + // TODO: test SetWAFRuleSetAndWafModeBehaviorArgument + } + + /** + * Test the property 'setWafRulesetAndWafMode' + */ + @Test + public void setWafRulesetAndWafModeTest() { + // TODO: test setWafRulesetAndWafMode + } + + /** + * Test the property 'wafMode' + */ + @Test + public void wafModeTest() { + // TODO: test wafMode + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorTest.java new file mode 100644 index 0000000..0d8d396 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetAndWafModeBehaviorTest.java @@ -0,0 +1,57 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetWAFRuleSetAndWafModeBehaviorArgument; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetWAFRuleSetAndWafModeBehavior + */ +public class SetWAFRuleSetAndWafModeBehaviorTest { + private final SetWAFRuleSetAndWafModeBehavior model = new SetWAFRuleSetAndWafModeBehavior(); + + /** + * Model tests for SetWAFRuleSetAndWafModeBehavior + */ + @Test + public void testSetWAFRuleSetAndWafModeBehavior() { + // TODO: test SetWAFRuleSetAndWafModeBehavior + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'argument' + */ + @Test + public void argumentTest() { + // TODO: test argument + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgumentTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgumentTest.java new file mode 100644 index 0000000..d92feee --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorArgumentTest.java @@ -0,0 +1,56 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetWAFRuleSetBehaviorArgument + */ +public class SetWAFRuleSetBehaviorArgumentTest { + private final SetWAFRuleSetBehaviorArgument model = new SetWAFRuleSetBehaviorArgument(); + + /** + * Model tests for SetWAFRuleSetBehaviorArgument + */ + @Test + public void testSetWAFRuleSetBehaviorArgument() { + // TODO: test SetWAFRuleSetBehaviorArgument + } + + /** + * Test the property 'wafId' + */ + @Test + public void wafIdTest() { + // TODO: test wafId + } + + /** + * Test the property 'mode' + */ + @Test + public void modeTest() { + // TODO: test mode + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorTest.java new file mode 100644 index 0000000..fd9ec88 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SetWAFRuleSetBehaviorTest.java @@ -0,0 +1,57 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SetWAFRuleSetBehaviorArgument; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SetWAFRuleSetBehavior + */ +public class SetWAFRuleSetBehaviorTest { + private final SetWAFRuleSetBehavior model = new SetWAFRuleSetBehavior(); + + /** + * Model tests for SetWAFRuleSetBehavior + */ + @Test + public void testSetWAFRuleSetBehavior() { + // TODO: test SetWAFRuleSetBehavior + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'argument' + */ + @Test + public void argumentTest() { + // TODO: test argument + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorArgumentTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorArgumentTest.java new file mode 100644 index 0000000..f83c2a1 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorArgumentTest.java @@ -0,0 +1,34 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleArgumentBehaviorArgument + */ +public class SimpleArgumentBehaviorArgumentTest { + private final SimpleArgumentBehaviorArgument model = new SimpleArgumentBehaviorArgument(); + + /** + * Model tests for SimpleArgumentBehaviorArgument + */ + @Test + public void testSimpleArgumentBehaviorArgument() { + // TODO: test SimpleArgumentBehaviorArgument + } + +} diff --git a/edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorTest.java b/edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorTest.java new file mode 100644 index 0000000..218b902 --- /dev/null +++ b/edgefirewall/src/test/java/org/openapitools/client/model/SimpleArgumentBehaviorTest.java @@ -0,0 +1,57 @@ +/* + * Edge Firewall API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.SimpleArgumentBehaviorArgument; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleArgumentBehavior + */ +public class SimpleArgumentBehaviorTest { + private final SimpleArgumentBehavior model = new SimpleArgumentBehavior(); + + /** + * Model tests for SimpleArgumentBehavior + */ + @Test + public void testSimpleArgumentBehavior() { + // TODO: test SimpleArgumentBehavior + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'argument' + */ + @Test + public void argumentTest() { + // TODO: test argument + } + +}