diff --git a/.generated-info b/.generated-info index 07f40a846c1..8172ef793df 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "b75095c", - "generated": "2025-07-31 10:47:40.935" + "spec_repo_commit": "356ca3c", + "generated": "2025-07-31 15:21:07.525" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b125b71c69d..9e86624abd1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2015,14 +2015,56 @@ components: description: The definition of `ActionConnectionIntegration` object. oneOf: - $ref: '#/components/schemas/AWSIntegration' + - $ref: '#/components/schemas/AnthropicIntegration' + - $ref: '#/components/schemas/AsanaIntegration' + - $ref: '#/components/schemas/AzureIntegration' + - $ref: '#/components/schemas/CircleCIIntegration' + - $ref: '#/components/schemas/ClickupIntegration' + - $ref: '#/components/schemas/CloudflareIntegration' + - $ref: '#/components/schemas/ConfigCatIntegration' - $ref: '#/components/schemas/DatadogIntegration' + - $ref: '#/components/schemas/FastlyIntegration' + - $ref: '#/components/schemas/FreshserviceIntegration' + - $ref: '#/components/schemas/GCPIntegration' + - $ref: '#/components/schemas/GeminiIntegration' + - $ref: '#/components/schemas/GitlabIntegration' + - $ref: '#/components/schemas/GreyNoiseIntegration' - $ref: '#/components/schemas/HTTPIntegration' + - $ref: '#/components/schemas/LaunchDarklyIntegration' + - $ref: '#/components/schemas/NotionIntegration' + - $ref: '#/components/schemas/OktaIntegration' + - $ref: '#/components/schemas/OpenAIIntegration' + - $ref: '#/components/schemas/ServiceNowIntegration' + - $ref: '#/components/schemas/SplitIntegration' + - $ref: '#/components/schemas/StatsigIntegration' + - $ref: '#/components/schemas/VirusTotalIntegration' ActionConnectionIntegrationUpdate: description: The definition of `ActionConnectionIntegrationUpdate` object. oneOf: - $ref: '#/components/schemas/AWSIntegrationUpdate' + - $ref: '#/components/schemas/AnthropicIntegrationUpdate' + - $ref: '#/components/schemas/AsanaIntegrationUpdate' + - $ref: '#/components/schemas/AzureIntegrationUpdate' + - $ref: '#/components/schemas/CircleCIIntegrationUpdate' + - $ref: '#/components/schemas/ClickupIntegrationUpdate' + - $ref: '#/components/schemas/CloudflareIntegrationUpdate' + - $ref: '#/components/schemas/ConfigCatIntegrationUpdate' - $ref: '#/components/schemas/DatadogIntegrationUpdate' + - $ref: '#/components/schemas/FastlyIntegrationUpdate' + - $ref: '#/components/schemas/FreshserviceIntegrationUpdate' + - $ref: '#/components/schemas/GCPIntegrationUpdate' + - $ref: '#/components/schemas/GeminiIntegrationUpdate' + - $ref: '#/components/schemas/GitlabIntegrationUpdate' + - $ref: '#/components/schemas/GreyNoiseIntegrationUpdate' - $ref: '#/components/schemas/HTTPIntegrationUpdate' + - $ref: '#/components/schemas/LaunchDarklyIntegrationUpdate' + - $ref: '#/components/schemas/NotionIntegrationUpdate' + - $ref: '#/components/schemas/OktaIntegrationUpdate' + - $ref: '#/components/schemas/OpenAIIntegrationUpdate' + - $ref: '#/components/schemas/ServiceNowIntegrationUpdate' + - $ref: '#/components/schemas/SplitIntegrationUpdate' + - $ref: '#/components/schemas/StatsigIntegrationUpdate' + - $ref: '#/components/schemas/VirusTotalIntegrationUpdate' ActionQuery: description: An action query. This query type is used to trigger an action, such as sending a HTTP request. @@ -2515,6 +2557,75 @@ components: description: The `markdownTextAnnotation` `text`. type: string type: object + AnthropicAPIKey: + description: The definition of the `AnthropicAPIKey` object. + properties: + api_token: + description: The `AnthropicAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/AnthropicAPIKeyType' + required: + - type + - api_token + type: object + AnthropicAPIKeyType: + description: The definition of the `AnthropicAPIKey` object. + enum: + - AnthropicAPIKey + example: AnthropicAPIKey + type: string + x-enum-varnames: + - ANTHROPICAPIKEY + AnthropicAPIKeyUpdate: + description: The definition of the `AnthropicAPIKey` object. + properties: + api_token: + description: The `AnthropicAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/AnthropicAPIKeyType' + required: + - type + type: object + AnthropicCredentials: + description: The definition of the `AnthropicCredentials` object. + oneOf: + - $ref: '#/components/schemas/AnthropicAPIKey' + AnthropicCredentialsUpdate: + description: The definition of the `AnthropicCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/AnthropicAPIKeyUpdate' + AnthropicIntegration: + description: The definition of the `AnthropicIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/AnthropicCredentials' + type: + $ref: '#/components/schemas/AnthropicIntegrationType' + required: + - type + - credentials + type: object + AnthropicIntegrationType: + description: The definition of the `AnthropicIntegrationType` object. + enum: + - Anthropic + example: Anthropic + type: string + x-enum-varnames: + - ANTHROPIC + AnthropicIntegrationUpdate: + description: The definition of the `AnthropicIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/AnthropicCredentialsUpdate' + type: + $ref: '#/components/schemas/AnthropicIntegrationType' + required: + - type + type: object ApiID: description: API identifier. example: 90646597-5fdb-4a17-a240-647003f8c028 @@ -3627,6 +3738,75 @@ components: - CREATED_AT_DESC - UPDATED_AT_DESC - USER_NAME_DESC + AsanaAccessToken: + description: The definition of the `AsanaAccessToken` object. + properties: + access_token: + description: The `AsanaAccessToken` `access_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/AsanaAccessTokenType' + required: + - type + - access_token + type: object + AsanaAccessTokenType: + description: The definition of the `AsanaAccessToken` object. + enum: + - AsanaAccessToken + example: AsanaAccessToken + type: string + x-enum-varnames: + - ASANAACCESSTOKEN + AsanaAccessTokenUpdate: + description: The definition of the `AsanaAccessToken` object. + properties: + access_token: + description: The `AsanaAccessTokenUpdate` `access_token`. + type: string + type: + $ref: '#/components/schemas/AsanaAccessTokenType' + required: + - type + type: object + AsanaCredentials: + description: The definition of the `AsanaCredentials` object. + oneOf: + - $ref: '#/components/schemas/AsanaAccessToken' + AsanaCredentialsUpdate: + description: The definition of the `AsanaCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/AsanaAccessTokenUpdate' + AsanaIntegration: + description: The definition of the `AsanaIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/AsanaCredentials' + type: + $ref: '#/components/schemas/AsanaIntegrationType' + required: + - type + - credentials + type: object + AsanaIntegrationType: + description: The definition of the `AsanaIntegrationType` object. + enum: + - Asana + example: Asana + type: string + x-enum-varnames: + - ASANA + AsanaIntegrationUpdate: + description: The definition of the `AsanaIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/AsanaCredentialsUpdate' + type: + $ref: '#/components/schemas/AsanaIntegrationType' + required: + - type + type: object Asset: description: A single vulnerable asset properties: @@ -4720,6 +4900,43 @@ components: required: - data type: object + AzureCredentials: + description: The definition of the `AzureCredentials` object. + oneOf: + - $ref: '#/components/schemas/AzureTenant' + AzureCredentialsUpdate: + description: The definition of the `AzureCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/AzureTenantUpdate' + AzureIntegration: + description: The definition of the `AzureIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/AzureCredentials' + type: + $ref: '#/components/schemas/AzureIntegrationType' + required: + - type + - credentials + type: object + AzureIntegrationType: + description: The definition of the `AzureIntegrationType` object. + enum: + - Azure + example: Azure + type: string + x-enum-varnames: + - AZURE + AzureIntegrationUpdate: + description: The definition of the `AzureIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/AzureCredentialsUpdate' + type: + $ref: '#/components/schemas/AzureIntegrationType' + required: + - type + type: object AzureStorageDestination: description: The `azure_storage` destination forwards logs to an Azure Blob Storage container. @@ -4762,6 +4979,88 @@ components: type: string x-enum-varnames: - AZURE_STORAGE + AzureTenant: + description: The definition of the `AzureTenant` object. + properties: + app_client_id: + description: 'The Client ID, also known as the Application ID in Azure, + is a unique identifier for an application. It''s used to identify the + application during the authentication process. Your Application (client) + ID is listed in the application''s overview page. You can navigate to + your application via the Azure Directory. ' + example: '' + type: string + client_secret: + description: "The Client Secret is a confidential piece of information known + only to the application and Azure AD. It's used to prove the application's + identity. Your Client Secret is available from the application\u2019s + secrets page. You can navigate to your application via the Azure Directory." + example: '' + type: string + custom_scopes: + description: If provided, the custom scope to be requested from Microsoft + when acquiring an OAuth 2 access token. This custom scope is used only + in conjunction with the HTTP action. A resource's scope is constructed + by using the identifier URI for the resource and .default, separated by + a forward slash (/) as follows:{identifierURI}/.default. + type: string + tenant_id: + description: The Tenant ID, also known as the Directory ID in Azure, is + a unique identifier that represents an Azure AD instance. Your Tenant + ID (Directory ID) is listed in your Active Directory overview page under + the 'Tenant information' section. + example: '' + type: string + type: + $ref: '#/components/schemas/AzureTenantType' + required: + - type + - tenant_id + - app_client_id + - client_secret + type: object + AzureTenantType: + description: The definition of the `AzureTenant` object. + enum: + - AzureTenant + example: AzureTenant + type: string + x-enum-varnames: + - AZURETENANT + AzureTenantUpdate: + description: The definition of the `AzureTenant` object. + properties: + app_client_id: + description: 'The Client ID, also known as the Application ID in Azure, + is a unique identifier for an application. It''s used to identify the + application during the authentication process. Your Application (client) + ID is listed in the application''s overview page. You can navigate to + your application via the Azure Directory. ' + type: string + client_secret: + description: "The Client Secret is a confidential piece of information known + only to the application and Azure AD. It's used to prove the application's + identity. Your Client Secret is available from the application\u2019s + secrets page. You can navigate to your application via the Azure Directory." + type: string + custom_scopes: + description: If provided, the custom scope to be requested from Microsoft + when acquiring an OAuth 2 access token. This custom scope is used only + in conjunction with the HTTP action. A resource's scope is constructed + by using the identifier URI for the resource and .default, separated by + a forward slash (/) as follows:{identifierURI}/.default. + type: string + tenant_id: + description: The Tenant ID, also known as the Directory ID in Azure, is + a unique identifier that represents an Azure AD instance. Your Tenant + ID (Directory ID) is listed in your Active Directory overview page under + the 'Tenant information' section. + type: string + type: + $ref: '#/components/schemas/AzureTenantType' + required: + - type + type: object AzureUCConfig: description: Azure config. properties: @@ -7498,6 +7797,144 @@ components: example: infra_host type: string type: object + CircleCIAPIKey: + description: The definition of the `CircleCIAPIKey` object. + properties: + api_token: + description: The `CircleCIAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/CircleCIAPIKeyType' + required: + - type + - api_token + type: object + CircleCIAPIKeyType: + description: The definition of the `CircleCIAPIKey` object. + enum: + - CircleCIAPIKey + example: CircleCIAPIKey + type: string + x-enum-varnames: + - CIRCLECIAPIKEY + CircleCIAPIKeyUpdate: + description: The definition of the `CircleCIAPIKey` object. + properties: + api_token: + description: The `CircleCIAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/CircleCIAPIKeyType' + required: + - type + type: object + CircleCICredentials: + description: The definition of the `CircleCICredentials` object. + oneOf: + - $ref: '#/components/schemas/CircleCIAPIKey' + CircleCICredentialsUpdate: + description: The definition of the `CircleCICredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/CircleCIAPIKeyUpdate' + CircleCIIntegration: + description: The definition of the `CircleCIIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/CircleCICredentials' + type: + $ref: '#/components/schemas/CircleCIIntegrationType' + required: + - type + - credentials + type: object + CircleCIIntegrationType: + description: The definition of the `CircleCIIntegrationType` object. + enum: + - CircleCI + example: CircleCI + type: string + x-enum-varnames: + - CIRCLECI + CircleCIIntegrationUpdate: + description: The definition of the `CircleCIIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/CircleCICredentialsUpdate' + type: + $ref: '#/components/schemas/CircleCIIntegrationType' + required: + - type + type: object + ClickupAPIKey: + description: The definition of the `ClickupAPIKey` object. + properties: + api_token: + description: The `ClickupAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/ClickupAPIKeyType' + required: + - type + - api_token + type: object + ClickupAPIKeyType: + description: The definition of the `ClickupAPIKey` object. + enum: + - ClickupAPIKey + example: ClickupAPIKey + type: string + x-enum-varnames: + - CLICKUPAPIKEY + ClickupAPIKeyUpdate: + description: The definition of the `ClickupAPIKey` object. + properties: + api_token: + description: The `ClickupAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/ClickupAPIKeyType' + required: + - type + type: object + ClickupCredentials: + description: The definition of the `ClickupCredentials` object. + oneOf: + - $ref: '#/components/schemas/ClickupAPIKey' + ClickupCredentialsUpdate: + description: The definition of the `ClickupCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/ClickupAPIKeyUpdate' + ClickupIntegration: + description: The definition of the `ClickupIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/ClickupCredentials' + type: + $ref: '#/components/schemas/ClickupIntegrationType' + required: + - type + - credentials + type: object + ClickupIntegrationType: + description: The definition of the `ClickupIntegrationType` object. + enum: + - Clickup + example: Clickup + type: string + x-enum-varnames: + - CLICKUP + ClickupIntegrationUpdate: + description: The definition of the `ClickupIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/ClickupCredentialsUpdate' + type: + $ref: '#/components/schemas/ClickupIntegrationType' + required: + - type + type: object CloudConfigurationComplianceRuleOptions: additionalProperties: {} description: 'Options for cloud_configuration rules. @@ -8337,6 +8774,38 @@ components: $ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleData' type: array type: object + CloudflareAPIToken: + description: The definition of the `CloudflareAPIToken` object. + properties: + api_token: + description: The `CloudflareAPIToken` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/CloudflareAPITokenType' + required: + - type + - api_token + type: object + CloudflareAPITokenType: + description: The definition of the `CloudflareAPIToken` object. + enum: + - CloudflareAPIToken + example: CloudflareAPIToken + type: string + x-enum-varnames: + - CLOUDFLAREAPITOKEN + CloudflareAPITokenUpdate: + description: The definition of the `CloudflareAPIToken` object. + properties: + api_token: + description: The `CloudflareAPITokenUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/CloudflareAPITokenType' + required: + - type + type: object CloudflareAccountCreateRequest: description: Payload schema when adding a Cloudflare account. properties: @@ -8521,6 +8990,85 @@ components: $ref: '#/components/schemas/CloudflareAccountResponseData' type: array type: object + CloudflareCredentials: + description: The definition of the `CloudflareCredentials` object. + oneOf: + - $ref: '#/components/schemas/CloudflareAPIToken' + - $ref: '#/components/schemas/CloudflareGlobalAPIToken' + CloudflareCredentialsUpdate: + description: The definition of the `CloudflareCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/CloudflareAPITokenUpdate' + - $ref: '#/components/schemas/CloudflareGlobalAPITokenUpdate' + CloudflareGlobalAPIToken: + description: The definition of the `CloudflareGlobalAPIToken` object. + properties: + auth_email: + description: The `CloudflareGlobalAPIToken` `auth_email`. + example: '' + type: string + global_api_key: + description: The `CloudflareGlobalAPIToken` `global_api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/CloudflareGlobalAPITokenType' + required: + - type + - auth_email + - global_api_key + type: object + CloudflareGlobalAPITokenType: + description: The definition of the `CloudflareGlobalAPIToken` object. + enum: + - CloudflareGlobalAPIToken + example: CloudflareGlobalAPIToken + type: string + x-enum-varnames: + - CLOUDFLAREGLOBALAPITOKEN + CloudflareGlobalAPITokenUpdate: + description: The definition of the `CloudflareGlobalAPIToken` object. + properties: + auth_email: + description: The `CloudflareGlobalAPITokenUpdate` `auth_email`. + type: string + global_api_key: + description: The `CloudflareGlobalAPITokenUpdate` `global_api_key`. + type: string + type: + $ref: '#/components/schemas/CloudflareGlobalAPITokenType' + required: + - type + type: object + CloudflareIntegration: + description: The definition of the `CloudflareIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/CloudflareCredentials' + type: + $ref: '#/components/schemas/CloudflareIntegrationType' + required: + - type + - credentials + type: object + CloudflareIntegrationType: + description: The definition of the `CloudflareIntegrationType` object. + enum: + - Cloudflare + example: Cloudflare + type: string + x-enum-varnames: + - CLOUDFLARE + CloudflareIntegrationUpdate: + description: The definition of the `CloudflareIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/CloudflareCredentialsUpdate' + type: + $ref: '#/components/schemas/CloudflareIntegrationType' + required: + - type + type: object CodeLocation: description: Code vulnerability location. properties: @@ -8747,6 +9295,91 @@ components: - SEARCH - CONTAINER - CALLOUTVALUE + ConfigCatCredentials: + description: The definition of the `ConfigCatCredentials` object. + oneOf: + - $ref: '#/components/schemas/ConfigCatSDKKey' + ConfigCatCredentialsUpdate: + description: The definition of the `ConfigCatCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/ConfigCatSDKKeyUpdate' + ConfigCatIntegration: + description: The definition of the `ConfigCatIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/ConfigCatCredentials' + type: + $ref: '#/components/schemas/ConfigCatIntegrationType' + required: + - type + - credentials + type: object + ConfigCatIntegrationType: + description: The definition of the `ConfigCatIntegrationType` object. + enum: + - ConfigCat + example: ConfigCat + type: string + x-enum-varnames: + - CONFIGCAT + ConfigCatIntegrationUpdate: + description: The definition of the `ConfigCatIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/ConfigCatCredentialsUpdate' + type: + $ref: '#/components/schemas/ConfigCatIntegrationType' + required: + - type + type: object + ConfigCatSDKKey: + description: The definition of the `ConfigCatSDKKey` object. + properties: + api_password: + description: The `ConfigCatSDKKey` `api_password`. + example: '' + type: string + api_username: + description: The `ConfigCatSDKKey` `api_username`. + example: '' + type: string + sdk_key: + description: The `ConfigCatSDKKey` `sdk_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/ConfigCatSDKKeyType' + required: + - type + - sdk_key + - api_username + - api_password + type: object + ConfigCatSDKKeyType: + description: The definition of the `ConfigCatSDKKey` object. + enum: + - ConfigCatSDKKey + example: ConfigCatSDKKey + type: string + x-enum-varnames: + - CONFIGCATSDKKEY + ConfigCatSDKKeyUpdate: + description: The definition of the `ConfigCatSDKKey` object. + properties: + api_password: + description: The `ConfigCatSDKKeyUpdate` `api_password`. + type: string + api_username: + description: The `ConfigCatSDKKeyUpdate` `api_username`. + type: string + sdk_key: + description: The `ConfigCatSDKKeyUpdate` `sdk_key`. + type: string + type: + $ref: '#/components/schemas/ConfigCatSDKKeyType' + required: + - type + type: object ConfluentAccountCreateRequest: description: Payload schema when adding a Confluent account. properties: @@ -15913,6 +16546,38 @@ components: from the other indexes. type: string type: object + FastlyAPIKey: + description: The definition of the `FastlyAPIKey` object. + properties: + api_key: + description: The `FastlyAPIKey` `api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/FastlyAPIKeyType' + required: + - type + - api_key + type: object + FastlyAPIKeyType: + description: The definition of the `FastlyAPIKey` object. + enum: + - FastlyAPIKey + example: FastlyAPIKey + type: string + x-enum-varnames: + - FASTLYAPIKEY + FastlyAPIKeyUpdate: + description: The definition of the `FastlyAPIKey` object. + properties: + api_key: + description: The `FastlyAPIKeyUpdate` `api_key`. + type: string + type: + $ref: '#/components/schemas/FastlyAPIKeyType' + required: + - type + type: object FastlyAccounResponseAttributes: description: Attributes object of a Fastly account. properties: @@ -16034,6 +16699,43 @@ components: $ref: '#/components/schemas/FastlyAccountResponseData' type: array type: object + FastlyCredentials: + description: The definition of the `FastlyCredentials` object. + oneOf: + - $ref: '#/components/schemas/FastlyAPIKey' + FastlyCredentialsUpdate: + description: The definition of the `FastlyCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/FastlyAPIKeyUpdate' + FastlyIntegration: + description: The definition of the `FastlyIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/FastlyCredentials' + type: + $ref: '#/components/schemas/FastlyIntegrationType' + required: + - type + - credentials + type: object + FastlyIntegrationType: + description: The definition of the `FastlyIntegrationType` object. + enum: + - Fastly + example: Fastly + type: string + x-enum-varnames: + - FASTLY + FastlyIntegrationUpdate: + description: The definition of the `FastlyIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/FastlyCredentialsUpdate' + type: + $ref: '#/components/schemas/FastlyIntegrationType' + required: + - type + type: object FastlyService: description: The schema representation of a Fastly service. properties: @@ -16379,6 +17081,83 @@ components: - type - attributes type: object + FreshserviceAPIKey: + description: The definition of the `FreshserviceAPIKey` object. + properties: + api_key: + description: The `FreshserviceAPIKey` `api_key`. + example: '' + type: string + domain: + description: The `FreshserviceAPIKey` `domain`. + example: '' + type: string + type: + $ref: '#/components/schemas/FreshserviceAPIKeyType' + required: + - type + - domain + - api_key + type: object + FreshserviceAPIKeyType: + description: The definition of the `FreshserviceAPIKey` object. + enum: + - FreshserviceAPIKey + example: FreshserviceAPIKey + type: string + x-enum-varnames: + - FRESHSERVICEAPIKEY + FreshserviceAPIKeyUpdate: + description: The definition of the `FreshserviceAPIKey` object. + properties: + api_key: + description: The `FreshserviceAPIKeyUpdate` `api_key`. + type: string + domain: + description: The `FreshserviceAPIKeyUpdate` `domain`. + type: string + type: + $ref: '#/components/schemas/FreshserviceAPIKeyType' + required: + - type + type: object + FreshserviceCredentials: + description: The definition of the `FreshserviceCredentials` object. + oneOf: + - $ref: '#/components/schemas/FreshserviceAPIKey' + FreshserviceCredentialsUpdate: + description: The definition of the `FreshserviceCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/FreshserviceAPIKeyUpdate' + FreshserviceIntegration: + description: The definition of the `FreshserviceIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/FreshserviceCredentials' + type: + $ref: '#/components/schemas/FreshserviceIntegrationType' + required: + - type + - credentials + type: object + FreshserviceIntegrationType: + description: The definition of the `FreshserviceIntegrationType` object. + enum: + - Freshservice + example: Freshservice + type: string + x-enum-varnames: + - FRESHSERVICE + FreshserviceIntegrationUpdate: + description: The definition of the `FreshserviceIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/FreshserviceCredentialsUpdate' + type: + $ref: '#/components/schemas/FreshserviceIntegrationType' + required: + - type + type: object FullAPIKey: description: Datadog API key. properties: @@ -16524,6 +17303,43 @@ components: - name - requirements type: object + GCPCredentials: + description: The definition of the `GCPCredentials` object. + oneOf: + - $ref: '#/components/schemas/GCPServiceAccount' + GCPCredentialsUpdate: + description: The definition of the `GCPCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/GCPServiceAccountUpdate' + GCPIntegration: + description: The definition of the `GCPIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/GCPCredentials' + type: + $ref: '#/components/schemas/GCPIntegrationType' + required: + - type + - credentials + type: object + GCPIntegrationType: + description: The definition of the `GCPIntegrationType` object. + enum: + - GCP + example: GCP + type: string + x-enum-varnames: + - GCP + GCPIntegrationUpdate: + description: The definition of the `GCPIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/GCPCredentialsUpdate' + type: + $ref: '#/components/schemas/GCPIntegrationType' + required: + - type + type: object GCPMetricNamespaceConfig: description: Configuration for a GCP metric namespace. properties: @@ -16706,6 +17522,32 @@ components: $ref: '#/components/schemas/GCPSTSServiceAccount' type: array type: object + GCPServiceAccount: + description: The definition of the `GCPServiceAccount` object. + properties: + private_key: + description: The `GCPServiceAccount` `private_key`. + example: '' + type: string + service_account_email: + description: The `GCPServiceAccount` `service_account_email`. + example: '' + type: string + type: + $ref: '#/components/schemas/GCPServiceAccountCredentialType' + required: + - type + - service_account_email + - private_key + type: object + GCPServiceAccountCredentialType: + description: The definition of the `GCPServiceAccount` object. + enum: + - GCPServiceAccount + example: GCPServiceAccount + type: string + x-enum-varnames: + - GCPSERVICEACCOUNT GCPServiceAccountMeta: description: Additional information related to your service account. properties: @@ -16725,6 +17567,20 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT + GCPServiceAccountUpdate: + description: The definition of the `GCPServiceAccount` object. + properties: + private_key: + description: The `GCPServiceAccountUpdate` `private_key`. + type: string + service_account_email: + description: The `GCPServiceAccountUpdate` `service_account_email`. + type: string + type: + $ref: '#/components/schemas/GCPServiceAccountCredentialType' + required: + - type + type: object GCPUsageCostConfig: description: GCP Usage Cost config. properties: @@ -16931,6 +17787,75 @@ components: $ref: '#/components/schemas/GCPUsageCostConfig' type: array type: object + GeminiAPIKey: + description: The definition of the `GeminiAPIKey` object. + properties: + api_key: + description: The `GeminiAPIKey` `api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/GeminiAPIKeyType' + required: + - type + - api_key + type: object + GeminiAPIKeyType: + description: The definition of the `GeminiAPIKey` object. + enum: + - GeminiAPIKey + example: GeminiAPIKey + type: string + x-enum-varnames: + - GEMINIAPIKEY + GeminiAPIKeyUpdate: + description: The definition of the `GeminiAPIKey` object. + properties: + api_key: + description: The `GeminiAPIKeyUpdate` `api_key`. + type: string + type: + $ref: '#/components/schemas/GeminiAPIKeyType' + required: + - type + type: object + GeminiCredentials: + description: The definition of the `GeminiCredentials` object. + oneOf: + - $ref: '#/components/schemas/GeminiAPIKey' + GeminiCredentialsUpdate: + description: The definition of the `GeminiCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/GeminiAPIKeyUpdate' + GeminiIntegration: + description: The definition of the `GeminiIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/GeminiCredentials' + type: + $ref: '#/components/schemas/GeminiIntegrationType' + required: + - type + - credentials + type: object + GeminiIntegrationType: + description: The definition of the `GeminiIntegrationType` object. + enum: + - Gemini + example: Gemini + type: string + x-enum-varnames: + - GEMINI + GeminiIntegrationUpdate: + description: The definition of the `GeminiIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/GeminiCredentialsUpdate' + type: + $ref: '#/components/schemas/GeminiIntegrationType' + required: + - type + type: object GetActionConnectionResponse: description: The response for found connection properties: @@ -17272,6 +18197,144 @@ components: required: - githubWebhookTrigger type: object + GitlabAPIKey: + description: The definition of the `GitlabAPIKey` object. + properties: + api_token: + description: The `GitlabAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/GitlabAPIKeyType' + required: + - type + - api_token + type: object + GitlabAPIKeyType: + description: The definition of the `GitlabAPIKey` object. + enum: + - GitlabAPIKey + example: GitlabAPIKey + type: string + x-enum-varnames: + - GITLABAPIKEY + GitlabAPIKeyUpdate: + description: The definition of the `GitlabAPIKey` object. + properties: + api_token: + description: The `GitlabAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/GitlabAPIKeyType' + required: + - type + type: object + GitlabCredentials: + description: The definition of the `GitlabCredentials` object. + oneOf: + - $ref: '#/components/schemas/GitlabAPIKey' + GitlabCredentialsUpdate: + description: The definition of the `GitlabCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/GitlabAPIKeyUpdate' + GitlabIntegration: + description: The definition of the `GitlabIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/GitlabCredentials' + type: + $ref: '#/components/schemas/GitlabIntegrationType' + required: + - type + - credentials + type: object + GitlabIntegrationType: + description: The definition of the `GitlabIntegrationType` object. + enum: + - Gitlab + example: Gitlab + type: string + x-enum-varnames: + - GITLAB + GitlabIntegrationUpdate: + description: The definition of the `GitlabIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/GitlabCredentialsUpdate' + type: + $ref: '#/components/schemas/GitlabIntegrationType' + required: + - type + type: object + GreyNoiseAPIKey: + description: The definition of the `GreyNoiseAPIKey` object. + properties: + api_key: + description: The `GreyNoiseAPIKey` `api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/GreyNoiseAPIKeyType' + required: + - type + - api_key + type: object + GreyNoiseAPIKeyType: + description: The definition of the `GreyNoiseAPIKey` object. + enum: + - GreyNoiseAPIKey + example: GreyNoiseAPIKey + type: string + x-enum-varnames: + - GREYNOISEAPIKEY + GreyNoiseAPIKeyUpdate: + description: The definition of the `GreyNoiseAPIKey` object. + properties: + api_key: + description: The `GreyNoiseAPIKeyUpdate` `api_key`. + type: string + type: + $ref: '#/components/schemas/GreyNoiseAPIKeyType' + required: + - type + type: object + GreyNoiseCredentials: + description: The definition of the `GreyNoiseCredentials` object. + oneOf: + - $ref: '#/components/schemas/GreyNoiseAPIKey' + GreyNoiseCredentialsUpdate: + description: The definition of the `GreyNoiseCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/GreyNoiseAPIKeyUpdate' + GreyNoiseIntegration: + description: The definition of the `GreyNoiseIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/GreyNoiseCredentials' + type: + $ref: '#/components/schemas/GreyNoiseIntegrationType' + required: + - type + - credentials + type: object + GreyNoiseIntegrationType: + description: The definition of the `GreyNoiseIntegrationType` object. + enum: + - GreyNoise + example: GreyNoise + type: string + x-enum-varnames: + - GREYNOISE + GreyNoiseIntegrationUpdate: + description: The definition of the `GreyNoiseIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/GreyNoiseCredentialsUpdate' + type: + $ref: '#/components/schemas/GreyNoiseIntegrationType' + required: + - type + type: object GroupScalarColumn: description: A column containing the tag keys and values in a group. properties: @@ -20476,6 +21539,75 @@ components: format: int64 type: integer type: object + LaunchDarklyAPIKey: + description: The definition of the `LaunchDarklyAPIKey` object. + properties: + api_token: + description: The `LaunchDarklyAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/LaunchDarklyAPIKeyType' + required: + - type + - api_token + type: object + LaunchDarklyAPIKeyType: + description: The definition of the `LaunchDarklyAPIKey` object. + enum: + - LaunchDarklyAPIKey + example: LaunchDarklyAPIKey + type: string + x-enum-varnames: + - LAUNCHDARKLYAPIKEY + LaunchDarklyAPIKeyUpdate: + description: The definition of the `LaunchDarklyAPIKey` object. + properties: + api_token: + description: The `LaunchDarklyAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/LaunchDarklyAPIKeyType' + required: + - type + type: object + LaunchDarklyCredentials: + description: The definition of the `LaunchDarklyCredentials` object. + oneOf: + - $ref: '#/components/schemas/LaunchDarklyAPIKey' + LaunchDarklyCredentialsUpdate: + description: The definition of the `LaunchDarklyCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/LaunchDarklyAPIKeyUpdate' + LaunchDarklyIntegration: + description: The definition of the `LaunchDarklyIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/LaunchDarklyCredentials' + type: + $ref: '#/components/schemas/LaunchDarklyIntegrationType' + required: + - type + - credentials + type: object + LaunchDarklyIntegrationType: + description: The definition of the `LaunchDarklyIntegrationType` object. + enum: + - LaunchDarkly + example: LaunchDarkly + type: string + x-enum-varnames: + - LAUNCHDARKLY + LaunchDarklyIntegrationUpdate: + description: The definition of the `LaunchDarklyIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/LaunchDarklyCredentialsUpdate' + type: + $ref: '#/components/schemas/LaunchDarklyIntegrationType' + required: + - type + type: object Layer: description: Encapsulates a layer resource, holding attributes like rotation details, plus relationships to the members covering that layer. @@ -25164,6 +26296,75 @@ components: type: string x-enum-varnames: - NOTIFICATION_RULES + NotionAPIKey: + description: The definition of the `NotionAPIKey` object. + properties: + api_token: + description: The `NotionAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/NotionAPIKeyType' + required: + - type + - api_token + type: object + NotionAPIKeyType: + description: The definition of the `NotionAPIKey` object. + enum: + - NotionAPIKey + example: NotionAPIKey + type: string + x-enum-varnames: + - NOTIONAPIKEY + NotionAPIKeyUpdate: + description: The definition of the `NotionAPIKey` object. + properties: + api_token: + description: The `NotionAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/NotionAPIKeyType' + required: + - type + type: object + NotionCredentials: + description: The definition of the `NotionCredentials` object. + oneOf: + - $ref: '#/components/schemas/NotionAPIKey' + NotionCredentialsUpdate: + description: The definition of the `NotionCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/NotionAPIKeyUpdate' + NotionIntegration: + description: The definition of the `NotionIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/NotionCredentials' + type: + $ref: '#/components/schemas/NotionIntegrationType' + required: + - type + - credentials + type: object + NotionIntegrationType: + description: The definition of the `NotionIntegrationType` object. + enum: + - Notion + example: Notion + type: string + x-enum-varnames: + - NOTION + NotionIntegrationUpdate: + description: The definition of the `NotionIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/NotionCredentialsUpdate' + type: + $ref: '#/components/schemas/NotionIntegrationType' + required: + - type + type: object NullableRelationshipToUser: description: Relationship to user. nullable: true @@ -28339,6 +29540,46 @@ components: required: - crt_file type: object + OktaAPIToken: + description: The definition of the `OktaAPIToken` object. + properties: + api_token: + description: The `OktaAPIToken` `api_token`. + example: '' + type: string + domain: + description: The `OktaAPIToken` `domain`. + example: '' + type: string + type: + $ref: '#/components/schemas/OktaAPITokenType' + required: + - type + - domain + - api_token + type: object + OktaAPITokenType: + description: The definition of the `OktaAPIToken` object. + enum: + - OktaAPIToken + example: OktaAPIToken + type: string + x-enum-varnames: + - OKTAAPITOKEN + OktaAPITokenUpdate: + description: The definition of the `OktaAPIToken` object. + properties: + api_token: + description: The `OktaAPITokenUpdate` `api_token`. + type: string + domain: + description: The `OktaAPITokenUpdate` `domain`. + type: string + type: + $ref: '#/components/schemas/OktaAPITokenType' + required: + - type + type: object OktaAccount: description: Schema for an Okta account. properties: @@ -28475,6 +29716,43 @@ components: $ref: '#/components/schemas/OktaAccountResponseData' type: array type: object + OktaCredentials: + description: The definition of the `OktaCredentials` object. + oneOf: + - $ref: '#/components/schemas/OktaAPIToken' + OktaCredentialsUpdate: + description: The definition of the `OktaCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/OktaAPITokenUpdate' + OktaIntegration: + description: The definition of the `OktaIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/OktaCredentials' + type: + $ref: '#/components/schemas/OktaIntegrationType' + required: + - type + - credentials + type: object + OktaIntegrationType: + description: The definition of the `OktaIntegrationType` object. + enum: + - Okta + example: Okta + type: string + x-enum-varnames: + - OKTA + OktaIntegrationUpdate: + description: The definition of the `OktaIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/OktaCredentialsUpdate' + type: + $ref: '#/components/schemas/OktaIntegrationType' + required: + - type + type: object OnCallPageTargetType: description: The kind of target, `team_id` | `team_handle` | `user_id`. enum: @@ -28516,6 +29794,75 @@ components: type: string x-enum-varnames: - ON_DEMAND_CONCURRENCY_CAP + OpenAIAPIKey: + description: The definition of the `OpenAIAPIKey` object. + properties: + api_token: + description: The `OpenAIAPIKey` `api_token`. + example: '' + type: string + type: + $ref: '#/components/schemas/OpenAIAPIKeyType' + required: + - type + - api_token + type: object + OpenAIAPIKeyType: + description: The definition of the `OpenAIAPIKey` object. + enum: + - OpenAIAPIKey + example: OpenAIAPIKey + type: string + x-enum-varnames: + - OPENAIAPIKEY + OpenAIAPIKeyUpdate: + description: The definition of the `OpenAIAPIKey` object. + properties: + api_token: + description: The `OpenAIAPIKeyUpdate` `api_token`. + type: string + type: + $ref: '#/components/schemas/OpenAIAPIKeyType' + required: + - type + type: object + OpenAICredentials: + description: The definition of the `OpenAICredentials` object. + oneOf: + - $ref: '#/components/schemas/OpenAIAPIKey' + OpenAICredentialsUpdate: + description: The definition of the `OpenAICredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/OpenAIAPIKeyUpdate' + OpenAIIntegration: + description: The definition of the `OpenAIIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/OpenAICredentials' + type: + $ref: '#/components/schemas/OpenAIIntegrationType' + required: + - type + - credentials + type: object + OpenAIIntegrationType: + description: The definition of the `OpenAIIntegrationType` object. + enum: + - OpenAI + example: OpenAI + type: string + x-enum-varnames: + - OPENAI + OpenAIIntegrationUpdate: + description: The definition of the `OpenAIIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/OpenAICredentialsUpdate' + type: + $ref: '#/components/schemas/OpenAIIntegrationType' + required: + - type + type: object OpenAPIEndpoint: description: Endpoint info extracted from an `OpenAPI` specification. properties: @@ -38194,6 +39541,91 @@ components: $ref: '#/components/schemas/ServiceDefinitionData' type: array type: object + ServiceNowBasicAuth: + description: The definition of the `ServiceNowBasicAuth` object. + properties: + instance: + description: The `ServiceNowBasicAuth` `instance`. + example: '' + type: string + password: + description: The `ServiceNowBasicAuth` `password`. + example: '' + type: string + type: + $ref: '#/components/schemas/ServiceNowBasicAuthType' + username: + description: The `ServiceNowBasicAuth` `username`. + example: '' + type: string + required: + - type + - instance + - username + - password + type: object + ServiceNowBasicAuthType: + description: The definition of the `ServiceNowBasicAuth` object. + enum: + - ServiceNowBasicAuth + example: ServiceNowBasicAuth + type: string + x-enum-varnames: + - SERVICENOWBASICAUTH + ServiceNowBasicAuthUpdate: + description: The definition of the `ServiceNowBasicAuth` object. + properties: + instance: + description: The `ServiceNowBasicAuthUpdate` `instance`. + type: string + password: + description: The `ServiceNowBasicAuthUpdate` `password`. + type: string + type: + $ref: '#/components/schemas/ServiceNowBasicAuthType' + username: + description: The `ServiceNowBasicAuthUpdate` `username`. + type: string + required: + - type + type: object + ServiceNowCredentials: + description: The definition of the `ServiceNowCredentials` object. + oneOf: + - $ref: '#/components/schemas/ServiceNowBasicAuth' + ServiceNowCredentialsUpdate: + description: The definition of the `ServiceNowCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/ServiceNowBasicAuthUpdate' + ServiceNowIntegration: + description: The definition of the `ServiceNowIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/ServiceNowCredentials' + type: + $ref: '#/components/schemas/ServiceNowIntegrationType' + required: + - type + - credentials + type: object + ServiceNowIntegrationType: + description: The definition of the `ServiceNowIntegrationType` object. + enum: + - ServiceNow + example: ServiceNow + type: string + x-enum-varnames: + - SERVICENOW + ServiceNowIntegrationUpdate: + description: The definition of the `ServiceNowIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/ServiceNowCredentialsUpdate' + type: + $ref: '#/components/schemas/ServiceNowIntegrationType' + required: + - type + type: object ServiceNowTicket: description: ServiceNow ticket attached to case nullable: true @@ -39502,6 +40934,75 @@ components: - ONE_THREE - ONE_FOUR - ONE_FIVE + SplitAPIKey: + description: The definition of the `SplitAPIKey` object. + properties: + api_key: + description: The `SplitAPIKey` `api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/SplitAPIKeyType' + required: + - type + - api_key + type: object + SplitAPIKeyType: + description: The definition of the `SplitAPIKey` object. + enum: + - SplitAPIKey + example: SplitAPIKey + type: string + x-enum-varnames: + - SPLITAPIKEY + SplitAPIKeyUpdate: + description: The definition of the `SplitAPIKey` object. + properties: + api_key: + description: The `SplitAPIKeyUpdate` `api_key`. + type: string + type: + $ref: '#/components/schemas/SplitAPIKeyType' + required: + - type + type: object + SplitCredentials: + description: The definition of the `SplitCredentials` object. + oneOf: + - $ref: '#/components/schemas/SplitAPIKey' + SplitCredentialsUpdate: + description: The definition of the `SplitCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/SplitAPIKeyUpdate' + SplitIntegration: + description: The definition of the `SplitIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/SplitCredentials' + type: + $ref: '#/components/schemas/SplitIntegrationType' + required: + - type + - credentials + type: object + SplitIntegrationType: + description: The definition of the `SplitIntegrationType` object. + enum: + - Split + example: Split + type: string + x-enum-varnames: + - SPLIT + SplitIntegrationUpdate: + description: The definition of the `SplitIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/SplitCredentialsUpdate' + type: + $ref: '#/components/schemas/SplitIntegrationType' + required: + - type + type: object StartStepNames: description: A list of steps that run first after a trigger fires. example: @@ -39562,6 +41063,75 @@ components: type: string x-enum-varnames: - STATEVARIABLE + StatsigAPIKey: + description: The definition of the `StatsigAPIKey` object. + properties: + api_key: + description: The `StatsigAPIKey` `api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/StatsigAPIKeyType' + required: + - type + - api_key + type: object + StatsigAPIKeyType: + description: The definition of the `StatsigAPIKey` object. + enum: + - StatsigAPIKey + example: StatsigAPIKey + type: string + x-enum-varnames: + - STATSIGAPIKEY + StatsigAPIKeyUpdate: + description: The definition of the `StatsigAPIKey` object. + properties: + api_key: + description: The `StatsigAPIKeyUpdate` `api_key`. + type: string + type: + $ref: '#/components/schemas/StatsigAPIKeyType' + required: + - type + type: object + StatsigCredentials: + description: The definition of the `StatsigCredentials` object. + oneOf: + - $ref: '#/components/schemas/StatsigAPIKey' + StatsigCredentialsUpdate: + description: The definition of the `StatsigCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/StatsigAPIKeyUpdate' + StatsigIntegration: + description: The definition of the `StatsigIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/StatsigCredentials' + type: + $ref: '#/components/schemas/StatsigIntegrationType' + required: + - type + - credentials + type: object + StatsigIntegrationType: + description: The definition of the `StatsigIntegrationType` object. + enum: + - Statsig + example: Statsig + type: string + x-enum-varnames: + - STATSIG + StatsigIntegrationUpdate: + description: The definition of the `StatsigIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/StatsigCredentialsUpdate' + type: + $ref: '#/components/schemas/StatsigIntegrationType' + required: + - type + type: object Step: description: A Step is a sub-component of a workflow. Each Step performs an action. @@ -42155,6 +43725,75 @@ components: example: 1 format: int64 type: integer + VirusTotalAPIKey: + description: The definition of the `VirusTotalAPIKey` object. + properties: + api_key: + description: The `VirusTotalAPIKey` `api_key`. + example: '' + type: string + type: + $ref: '#/components/schemas/VirusTotalAPIKeyType' + required: + - type + - api_key + type: object + VirusTotalAPIKeyType: + description: The definition of the `VirusTotalAPIKey` object. + enum: + - VirusTotalAPIKey + example: VirusTotalAPIKey + type: string + x-enum-varnames: + - VIRUSTOTALAPIKEY + VirusTotalAPIKeyUpdate: + description: The definition of the `VirusTotalAPIKey` object. + properties: + api_key: + description: The `VirusTotalAPIKeyUpdate` `api_key`. + type: string + type: + $ref: '#/components/schemas/VirusTotalAPIKeyType' + required: + - type + type: object + VirusTotalCredentials: + description: The definition of the `VirusTotalCredentials` object. + oneOf: + - $ref: '#/components/schemas/VirusTotalAPIKey' + VirusTotalCredentialsUpdate: + description: The definition of the `VirusTotalCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/VirusTotalAPIKeyUpdate' + VirusTotalIntegration: + description: The definition of the `VirusTotalIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/VirusTotalCredentials' + type: + $ref: '#/components/schemas/VirusTotalIntegrationType' + required: + - type + - credentials + type: object + VirusTotalIntegrationType: + description: The definition of the `VirusTotalIntegrationType` object. + enum: + - VirusTotal + example: VirusTotal + type: string + x-enum-varnames: + - VIRUSTOTAL + VirusTotalIntegrationUpdate: + description: The definition of the `VirusTotalIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/VirusTotalCredentialsUpdate' + type: + $ref: '#/components/schemas/VirusTotalIntegrationType' + required: + - type + type: object VulnerabilitiesType: description: The JSON:API type. enum: diff --git a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java index 653b8632fd2..f4417b1a7c8 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java @@ -124,6 +124,317 @@ public ActionConnectionIntegration deserialize(JsonParser jp, DeserializationCon log.log(Level.FINER, "Input data does not match schema 'AWSIntegration'", e); } + // deserialize AnthropicIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AnthropicIntegration.class.equals(Integer.class) + || AnthropicIntegration.class.equals(Long.class) + || AnthropicIntegration.class.equals(Float.class) + || AnthropicIntegration.class.equals(Double.class) + || AnthropicIntegration.class.equals(Boolean.class) + || AnthropicIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AnthropicIntegration.class.equals(Integer.class) + || AnthropicIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AnthropicIntegration.class.equals(Float.class) + || AnthropicIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AnthropicIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AnthropicIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AnthropicIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AnthropicIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AnthropicIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AnthropicIntegration'", e); + } + + // deserialize AsanaIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AsanaIntegration.class.equals(Integer.class) + || AsanaIntegration.class.equals(Long.class) + || AsanaIntegration.class.equals(Float.class) + || AsanaIntegration.class.equals(Double.class) + || AsanaIntegration.class.equals(Boolean.class) + || AsanaIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AsanaIntegration.class.equals(Integer.class) + || AsanaIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AsanaIntegration.class.equals(Float.class) + || AsanaIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AsanaIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AsanaIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AsanaIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AsanaIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AsanaIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AsanaIntegration'", e); + } + + // deserialize AzureIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AzureIntegration.class.equals(Integer.class) + || AzureIntegration.class.equals(Long.class) + || AzureIntegration.class.equals(Float.class) + || AzureIntegration.class.equals(Double.class) + || AzureIntegration.class.equals(Boolean.class) + || AzureIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AzureIntegration.class.equals(Integer.class) + || AzureIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AzureIntegration.class.equals(Float.class) + || AzureIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AzureIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AzureIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AzureIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AzureIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AzureIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AzureIntegration'", e); + } + + // deserialize CircleCIIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CircleCIIntegration.class.equals(Integer.class) + || CircleCIIntegration.class.equals(Long.class) + || CircleCIIntegration.class.equals(Float.class) + || CircleCIIntegration.class.equals(Double.class) + || CircleCIIntegration.class.equals(Boolean.class) + || CircleCIIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CircleCIIntegration.class.equals(Integer.class) + || CircleCIIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CircleCIIntegration.class.equals(Float.class) + || CircleCIIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CircleCIIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CircleCIIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CircleCIIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CircleCIIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CircleCIIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CircleCIIntegration'", e); + } + + // deserialize ClickupIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ClickupIntegration.class.equals(Integer.class) + || ClickupIntegration.class.equals(Long.class) + || ClickupIntegration.class.equals(Float.class) + || ClickupIntegration.class.equals(Double.class) + || ClickupIntegration.class.equals(Boolean.class) + || ClickupIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ClickupIntegration.class.equals(Integer.class) + || ClickupIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ClickupIntegration.class.equals(Float.class) + || ClickupIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ClickupIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ClickupIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ClickupIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ClickupIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ClickupIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ClickupIntegration'", e); + } + + // deserialize CloudflareIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CloudflareIntegration.class.equals(Integer.class) + || CloudflareIntegration.class.equals(Long.class) + || CloudflareIntegration.class.equals(Float.class) + || CloudflareIntegration.class.equals(Double.class) + || CloudflareIntegration.class.equals(Boolean.class) + || CloudflareIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CloudflareIntegration.class.equals(Integer.class) + || CloudflareIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CloudflareIntegration.class.equals(Float.class) + || CloudflareIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CloudflareIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CloudflareIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CloudflareIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CloudflareIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CloudflareIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CloudflareIntegration'", e); + } + + // deserialize ConfigCatIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ConfigCatIntegration.class.equals(Integer.class) + || ConfigCatIntegration.class.equals(Long.class) + || ConfigCatIntegration.class.equals(Float.class) + || ConfigCatIntegration.class.equals(Double.class) + || ConfigCatIntegration.class.equals(Boolean.class) + || ConfigCatIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ConfigCatIntegration.class.equals(Integer.class) + || ConfigCatIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ConfigCatIntegration.class.equals(Float.class) + || ConfigCatIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ConfigCatIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ConfigCatIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ConfigCatIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ConfigCatIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ConfigCatIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ConfigCatIntegration'", e); + } + // deserialize DatadogIntegration try { boolean attemptParsing = true; @@ -168,48 +479,669 @@ public ActionConnectionIntegration deserialize(JsonParser jp, DeserializationCon log.log(Level.FINER, "Input data does not match schema 'DatadogIntegration'", e); } - // deserialize HTTPIntegration + // deserialize FastlyIntegration try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (HTTPIntegration.class.equals(Integer.class) - || HTTPIntegration.class.equals(Long.class) - || HTTPIntegration.class.equals(Float.class) - || HTTPIntegration.class.equals(Double.class) - || HTTPIntegration.class.equals(Boolean.class) - || HTTPIntegration.class.equals(String.class)) { + if (FastlyIntegration.class.equals(Integer.class) + || FastlyIntegration.class.equals(Long.class) + || FastlyIntegration.class.equals(Float.class) + || FastlyIntegration.class.equals(Double.class) + || FastlyIntegration.class.equals(Boolean.class) + || FastlyIntegration.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((HTTPIntegration.class.equals(Integer.class) - || HTTPIntegration.class.equals(Long.class)) + ((FastlyIntegration.class.equals(Integer.class) + || FastlyIntegration.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((HTTPIntegration.class.equals(Float.class) - || HTTPIntegration.class.equals(Double.class)) + ((FastlyIntegration.class.equals(Float.class) + || FastlyIntegration.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (HTTPIntegration.class.equals(Boolean.class) + (FastlyIntegration.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (HTTPIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + (FastlyIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPIntegration.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(FastlyIntegration.class); // TODO: there is no validation against JSON schema constraints // (min, max, enum, pattern...), this does not perform a strict JSON // validation, which means the 'match' count may be higher than it should be. - if (!((HTTPIntegration) tmp).unparsed) { + if (!((FastlyIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FastlyIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FastlyIntegration'", e); + } + + // deserialize FreshserviceIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (FreshserviceIntegration.class.equals(Integer.class) + || FreshserviceIntegration.class.equals(Long.class) + || FreshserviceIntegration.class.equals(Float.class) + || FreshserviceIntegration.class.equals(Double.class) + || FreshserviceIntegration.class.equals(Boolean.class) + || FreshserviceIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((FreshserviceIntegration.class.equals(Integer.class) + || FreshserviceIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((FreshserviceIntegration.class.equals(Float.class) + || FreshserviceIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (FreshserviceIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (FreshserviceIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FreshserviceIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FreshserviceIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FreshserviceIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FreshserviceIntegration'", e); + } + + // deserialize GCPIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GCPIntegration.class.equals(Integer.class) + || GCPIntegration.class.equals(Long.class) + || GCPIntegration.class.equals(Float.class) + || GCPIntegration.class.equals(Double.class) + || GCPIntegration.class.equals(Boolean.class) + || GCPIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GCPIntegration.class.equals(Integer.class) + || GCPIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GCPIntegration.class.equals(Float.class) + || GCPIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GCPIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GCPIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GCPIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GCPIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GCPIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GCPIntegration'", e); + } + + // deserialize GeminiIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GeminiIntegration.class.equals(Integer.class) + || GeminiIntegration.class.equals(Long.class) + || GeminiIntegration.class.equals(Float.class) + || GeminiIntegration.class.equals(Double.class) + || GeminiIntegration.class.equals(Boolean.class) + || GeminiIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GeminiIntegration.class.equals(Integer.class) + || GeminiIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GeminiIntegration.class.equals(Float.class) + || GeminiIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GeminiIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GeminiIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GeminiIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GeminiIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GeminiIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GeminiIntegration'", e); + } + + // deserialize GitlabIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitlabIntegration.class.equals(Integer.class) + || GitlabIntegration.class.equals(Long.class) + || GitlabIntegration.class.equals(Float.class) + || GitlabIntegration.class.equals(Double.class) + || GitlabIntegration.class.equals(Boolean.class) + || GitlabIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitlabIntegration.class.equals(Integer.class) + || GitlabIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitlabIntegration.class.equals(Float.class) + || GitlabIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitlabIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitlabIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GitlabIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitlabIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GitlabIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GitlabIntegration'", e); + } + + // deserialize GreyNoiseIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GreyNoiseIntegration.class.equals(Integer.class) + || GreyNoiseIntegration.class.equals(Long.class) + || GreyNoiseIntegration.class.equals(Float.class) + || GreyNoiseIntegration.class.equals(Double.class) + || GreyNoiseIntegration.class.equals(Boolean.class) + || GreyNoiseIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GreyNoiseIntegration.class.equals(Integer.class) + || GreyNoiseIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GreyNoiseIntegration.class.equals(Float.class) + || GreyNoiseIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GreyNoiseIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GreyNoiseIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GreyNoiseIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GreyNoiseIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GreyNoiseIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GreyNoiseIntegration'", e); + } + + // deserialize HTTPIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (HTTPIntegration.class.equals(Integer.class) + || HTTPIntegration.class.equals(Long.class) + || HTTPIntegration.class.equals(Float.class) + || HTTPIntegration.class.equals(Double.class) + || HTTPIntegration.class.equals(Boolean.class) + || HTTPIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((HTTPIntegration.class.equals(Integer.class) + || HTTPIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((HTTPIntegration.class.equals(Float.class) + || HTTPIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (HTTPIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (HTTPIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((HTTPIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'HTTPIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'HTTPIntegration'", e); + } + + // deserialize LaunchDarklyIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LaunchDarklyIntegration.class.equals(Integer.class) + || LaunchDarklyIntegration.class.equals(Long.class) + || LaunchDarklyIntegration.class.equals(Float.class) + || LaunchDarklyIntegration.class.equals(Double.class) + || LaunchDarklyIntegration.class.equals(Boolean.class) + || LaunchDarklyIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LaunchDarklyIntegration.class.equals(Integer.class) + || LaunchDarklyIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LaunchDarklyIntegration.class.equals(Float.class) + || LaunchDarklyIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LaunchDarklyIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LaunchDarklyIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LaunchDarklyIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LaunchDarklyIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LaunchDarklyIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LaunchDarklyIntegration'", e); + } + + // deserialize NotionIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (NotionIntegration.class.equals(Integer.class) + || NotionIntegration.class.equals(Long.class) + || NotionIntegration.class.equals(Float.class) + || NotionIntegration.class.equals(Double.class) + || NotionIntegration.class.equals(Boolean.class) + || NotionIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((NotionIntegration.class.equals(Integer.class) + || NotionIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((NotionIntegration.class.equals(Float.class) + || NotionIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (NotionIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (NotionIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(NotionIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((NotionIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'NotionIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NotionIntegration'", e); + } + + // deserialize OktaIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OktaIntegration.class.equals(Integer.class) + || OktaIntegration.class.equals(Long.class) + || OktaIntegration.class.equals(Float.class) + || OktaIntegration.class.equals(Double.class) + || OktaIntegration.class.equals(Boolean.class) + || OktaIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OktaIntegration.class.equals(Integer.class) + || OktaIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OktaIntegration.class.equals(Float.class) + || OktaIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OktaIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OktaIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OktaIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OktaIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OktaIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OktaIntegration'", e); + } + + // deserialize OpenAIIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIIntegration.class.equals(Integer.class) + || OpenAIIntegration.class.equals(Long.class) + || OpenAIIntegration.class.equals(Float.class) + || OpenAIIntegration.class.equals(Double.class) + || OpenAIIntegration.class.equals(Boolean.class) + || OpenAIIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIIntegration.class.equals(Integer.class) + || OpenAIIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIIntegration.class.equals(Float.class) + || OpenAIIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OpenAIIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OpenAIIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OpenAIIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OpenAIIntegration'", e); + } + + // deserialize ServiceNowIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ServiceNowIntegration.class.equals(Integer.class) + || ServiceNowIntegration.class.equals(Long.class) + || ServiceNowIntegration.class.equals(Float.class) + || ServiceNowIntegration.class.equals(Double.class) + || ServiceNowIntegration.class.equals(Boolean.class) + || ServiceNowIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ServiceNowIntegration.class.equals(Integer.class) + || ServiceNowIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ServiceNowIntegration.class.equals(Float.class) + || ServiceNowIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ServiceNowIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ServiceNowIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ServiceNowIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ServiceNowIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ServiceNowIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ServiceNowIntegration'", e); + } + + // deserialize SplitIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SplitIntegration.class.equals(Integer.class) + || SplitIntegration.class.equals(Long.class) + || SplitIntegration.class.equals(Float.class) + || SplitIntegration.class.equals(Double.class) + || SplitIntegration.class.equals(Boolean.class) + || SplitIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SplitIntegration.class.equals(Integer.class) + || SplitIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SplitIntegration.class.equals(Float.class) + || SplitIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SplitIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SplitIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SplitIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SplitIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SplitIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SplitIntegration'", e); + } + + // deserialize StatsigIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (StatsigIntegration.class.equals(Integer.class) + || StatsigIntegration.class.equals(Long.class) + || StatsigIntegration.class.equals(Float.class) + || StatsigIntegration.class.equals(Double.class) + || StatsigIntegration.class.equals(Boolean.class) + || StatsigIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((StatsigIntegration.class.equals(Integer.class) + || StatsigIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((StatsigIntegration.class.equals(Float.class) + || StatsigIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (StatsigIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (StatsigIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(StatsigIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((StatsigIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'StatsigIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'StatsigIntegration'", e); + } + + // deserialize VirusTotalIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VirusTotalIntegration.class.equals(Integer.class) + || VirusTotalIntegration.class.equals(Long.class) + || VirusTotalIntegration.class.equals(Float.class) + || VirusTotalIntegration.class.equals(Double.class) + || VirusTotalIntegration.class.equals(Boolean.class) + || VirusTotalIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VirusTotalIntegration.class.equals(Integer.class) + || VirusTotalIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VirusTotalIntegration.class.equals(Float.class) + || VirusTotalIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (VirusTotalIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VirusTotalIntegration.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(VirusTotalIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((VirusTotalIntegration) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'HTTPIntegration'"); + log.log(Level.FINER, "Input data matches schema 'VirusTotalIntegration'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'HTTPIntegration'", e); + log.log(Level.FINER, "Input data does not match schema 'VirusTotalIntegration'", e); } ActionConnectionIntegration ret = new ActionConnectionIntegration(); @@ -247,20 +1179,146 @@ public ActionConnectionIntegration(AWSIntegration o) { setActualInstance(o); } + public ActionConnectionIntegration(AnthropicIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(AsanaIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(AzureIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(CircleCIIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(ClickupIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(CloudflareIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(ConfigCatIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ActionConnectionIntegration(DatadogIntegration o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } + public ActionConnectionIntegration(FastlyIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(FreshserviceIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(GCPIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(GeminiIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(GitlabIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(GreyNoiseIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ActionConnectionIntegration(HTTPIntegration o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } + public ActionConnectionIntegration(LaunchDarklyIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(NotionIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(OktaIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(OpenAIIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(ServiceNowIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(SplitIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(StatsigIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(VirusTotalIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("AWSIntegration", new GenericType() {}); + schemas.put("AnthropicIntegration", new GenericType() {}); + schemas.put("AsanaIntegration", new GenericType() {}); + schemas.put("AzureIntegration", new GenericType() {}); + schemas.put("CircleCIIntegration", new GenericType() {}); + schemas.put("ClickupIntegration", new GenericType() {}); + schemas.put("CloudflareIntegration", new GenericType() {}); + schemas.put("ConfigCatIntegration", new GenericType() {}); schemas.put("DatadogIntegration", new GenericType() {}); + schemas.put("FastlyIntegration", new GenericType() {}); + schemas.put("FreshserviceIntegration", new GenericType() {}); + schemas.put("GCPIntegration", new GenericType() {}); + schemas.put("GeminiIntegration", new GenericType() {}); + schemas.put("GitlabIntegration", new GenericType() {}); + schemas.put("GreyNoiseIntegration", new GenericType() {}); schemas.put("HTTPIntegration", new GenericType() {}); + schemas.put("LaunchDarklyIntegration", new GenericType() {}); + schemas.put("NotionIntegration", new GenericType() {}); + schemas.put("OktaIntegration", new GenericType() {}); + schemas.put("OpenAIIntegration", new GenericType() {}); + schemas.put("ServiceNowIntegration", new GenericType() {}); + schemas.put("SplitIntegration", new GenericType() {}); + schemas.put("StatsigIntegration", new GenericType() {}); + schemas.put("VirusTotalIntegration", new GenericType() {}); JSON.registerDescendants( ActionConnectionIntegration.class, Collections.unmodifiableMap(schemas)); } @@ -272,7 +1330,12 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: AWSIntegration, DatadogIntegration, HTTPIntegration + * against the oneOf child schemas: AWSIntegration, AnthropicIntegration, AsanaIntegration, + * AzureIntegration, CircleCIIntegration, ClickupIntegration, CloudflareIntegration, + * ConfigCatIntegration, DatadogIntegration, FastlyIntegration, FreshserviceIntegration, + * GCPIntegration, GeminiIntegration, GitlabIntegration, GreyNoiseIntegration, HTTPIntegration, + * LaunchDarklyIntegration, NotionIntegration, OktaIntegration, OpenAIIntegration, + * ServiceNowIntegration, SplitIntegration, StatsigIntegration, VirusTotalIntegration * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -283,28 +1346,129 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(AnthropicIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(AsanaIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(AzureIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(CircleCIIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ClickupIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(CloudflareIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ConfigCatIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(DatadogIntegration.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(FastlyIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(FreshserviceIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GCPIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GeminiIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GitlabIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GreyNoiseIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(HTTPIntegration.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(LaunchDarklyIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(NotionIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(OktaIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(OpenAIIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ServiceNowIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(SplitIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(StatsigIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(VirusTotalIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be AWSIntegration, DatadogIntegration, HTTPIntegration"); + "Invalid instance type. Must be AWSIntegration, AnthropicIntegration, AsanaIntegration," + + " AzureIntegration, CircleCIIntegration, ClickupIntegration, CloudflareIntegration," + + " ConfigCatIntegration, DatadogIntegration, FastlyIntegration," + + " FreshserviceIntegration, GCPIntegration, GeminiIntegration, GitlabIntegration," + + " GreyNoiseIntegration, HTTPIntegration, LaunchDarklyIntegration, NotionIntegration," + + " OktaIntegration, OpenAIIntegration, ServiceNowIntegration, SplitIntegration," + + " StatsigIntegration, VirusTotalIntegration"); } /** - * Get the actual instance, which can be the following: AWSIntegration, DatadogIntegration, - * HTTPIntegration + * Get the actual instance, which can be the following: AWSIntegration, AnthropicIntegration, + * AsanaIntegration, AzureIntegration, CircleCIIntegration, ClickupIntegration, + * CloudflareIntegration, ConfigCatIntegration, DatadogIntegration, FastlyIntegration, + * FreshserviceIntegration, GCPIntegration, GeminiIntegration, GitlabIntegration, + * GreyNoiseIntegration, HTTPIntegration, LaunchDarklyIntegration, NotionIntegration, + * OktaIntegration, OpenAIIntegration, ServiceNowIntegration, SplitIntegration, + * StatsigIntegration, VirusTotalIntegration * - * @return The actual instance (AWSIntegration, DatadogIntegration, HTTPIntegration) + * @return The actual instance (AWSIntegration, AnthropicIntegration, AsanaIntegration, + * AzureIntegration, CircleCIIntegration, ClickupIntegration, CloudflareIntegration, + * ConfigCatIntegration, DatadogIntegration, FastlyIntegration, FreshserviceIntegration, + * GCPIntegration, GeminiIntegration, GitlabIntegration, GreyNoiseIntegration, + * HTTPIntegration, LaunchDarklyIntegration, NotionIntegration, OktaIntegration, + * OpenAIIntegration, ServiceNowIntegration, SplitIntegration, StatsigIntegration, + * VirusTotalIntegration) */ @Override public Object getActualInstance() { @@ -322,6 +1486,83 @@ public AWSIntegration getAWSIntegration() throws ClassCastException { return (AWSIntegration) super.getActualInstance(); } + /** + * Get the actual instance of `AnthropicIntegration`. If the actual instance is not + * `AnthropicIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `AnthropicIntegration` + * @throws ClassCastException if the instance is not `AnthropicIntegration` + */ + public AnthropicIntegration getAnthropicIntegration() throws ClassCastException { + return (AnthropicIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `AsanaIntegration`. If the actual instance is not + * `AsanaIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `AsanaIntegration` + * @throws ClassCastException if the instance is not `AsanaIntegration` + */ + public AsanaIntegration getAsanaIntegration() throws ClassCastException { + return (AsanaIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `AzureIntegration`. If the actual instance is not + * `AzureIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `AzureIntegration` + * @throws ClassCastException if the instance is not `AzureIntegration` + */ + public AzureIntegration getAzureIntegration() throws ClassCastException { + return (AzureIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `CircleCIIntegration`. If the actual instance is not + * `CircleCIIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `CircleCIIntegration` + * @throws ClassCastException if the instance is not `CircleCIIntegration` + */ + public CircleCIIntegration getCircleCIIntegration() throws ClassCastException { + return (CircleCIIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `ClickupIntegration`. If the actual instance is not + * `ClickupIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `ClickupIntegration` + * @throws ClassCastException if the instance is not `ClickupIntegration` + */ + public ClickupIntegration getClickupIntegration() throws ClassCastException { + return (ClickupIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `CloudflareIntegration`. If the actual instance is not + * `CloudflareIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `CloudflareIntegration` + * @throws ClassCastException if the instance is not `CloudflareIntegration` + */ + public CloudflareIntegration getCloudflareIntegration() throws ClassCastException { + return (CloudflareIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `ConfigCatIntegration`. If the actual instance is not + * `ConfigCatIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `ConfigCatIntegration` + * @throws ClassCastException if the instance is not `ConfigCatIntegration` + */ + public ConfigCatIntegration getConfigCatIntegration() throws ClassCastException { + return (ConfigCatIntegration) super.getActualInstance(); + } + /** * Get the actual instance of `DatadogIntegration`. If the actual instance is not * `DatadogIntegration`, the ClassCastException will be thrown. @@ -333,6 +1574,72 @@ public DatadogIntegration getDatadogIntegration() throws ClassCastException { return (DatadogIntegration) super.getActualInstance(); } + /** + * Get the actual instance of `FastlyIntegration`. If the actual instance is not + * `FastlyIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `FastlyIntegration` + * @throws ClassCastException if the instance is not `FastlyIntegration` + */ + public FastlyIntegration getFastlyIntegration() throws ClassCastException { + return (FastlyIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `FreshserviceIntegration`. If the actual instance is not + * `FreshserviceIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `FreshserviceIntegration` + * @throws ClassCastException if the instance is not `FreshserviceIntegration` + */ + public FreshserviceIntegration getFreshserviceIntegration() throws ClassCastException { + return (FreshserviceIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `GCPIntegration`. If the actual instance is not `GCPIntegration`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GCPIntegration` + * @throws ClassCastException if the instance is not `GCPIntegration` + */ + public GCPIntegration getGCPIntegration() throws ClassCastException { + return (GCPIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `GeminiIntegration`. If the actual instance is not + * `GeminiIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `GeminiIntegration` + * @throws ClassCastException if the instance is not `GeminiIntegration` + */ + public GeminiIntegration getGeminiIntegration() throws ClassCastException { + return (GeminiIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `GitlabIntegration`. If the actual instance is not + * `GitlabIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `GitlabIntegration` + * @throws ClassCastException if the instance is not `GitlabIntegration` + */ + public GitlabIntegration getGitlabIntegration() throws ClassCastException { + return (GitlabIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `GreyNoiseIntegration`. If the actual instance is not + * `GreyNoiseIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `GreyNoiseIntegration` + * @throws ClassCastException if the instance is not `GreyNoiseIntegration` + */ + public GreyNoiseIntegration getGreyNoiseIntegration() throws ClassCastException { + return (GreyNoiseIntegration) super.getActualInstance(); + } + /** * Get the actual instance of `HTTPIntegration`. If the actual instance is not `HTTPIntegration`, * the ClassCastException will be thrown. @@ -343,4 +1650,92 @@ public DatadogIntegration getDatadogIntegration() throws ClassCastException { public HTTPIntegration getHTTPIntegration() throws ClassCastException { return (HTTPIntegration) super.getActualInstance(); } + + /** + * Get the actual instance of `LaunchDarklyIntegration`. If the actual instance is not + * `LaunchDarklyIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `LaunchDarklyIntegration` + * @throws ClassCastException if the instance is not `LaunchDarklyIntegration` + */ + public LaunchDarklyIntegration getLaunchDarklyIntegration() throws ClassCastException { + return (LaunchDarklyIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `NotionIntegration`. If the actual instance is not + * `NotionIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `NotionIntegration` + * @throws ClassCastException if the instance is not `NotionIntegration` + */ + public NotionIntegration getNotionIntegration() throws ClassCastException { + return (NotionIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `OktaIntegration`. If the actual instance is not `OktaIntegration`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `OktaIntegration` + * @throws ClassCastException if the instance is not `OktaIntegration` + */ + public OktaIntegration getOktaIntegration() throws ClassCastException { + return (OktaIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIIntegration`. If the actual instance is not + * `OpenAIIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIIntegration` + * @throws ClassCastException if the instance is not `OpenAIIntegration` + */ + public OpenAIIntegration getOpenAIIntegration() throws ClassCastException { + return (OpenAIIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `ServiceNowIntegration`. If the actual instance is not + * `ServiceNowIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `ServiceNowIntegration` + * @throws ClassCastException if the instance is not `ServiceNowIntegration` + */ + public ServiceNowIntegration getServiceNowIntegration() throws ClassCastException { + return (ServiceNowIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `SplitIntegration`. If the actual instance is not + * `SplitIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `SplitIntegration` + * @throws ClassCastException if the instance is not `SplitIntegration` + */ + public SplitIntegration getSplitIntegration() throws ClassCastException { + return (SplitIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `StatsigIntegration`. If the actual instance is not + * `StatsigIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `StatsigIntegration` + * @throws ClassCastException if the instance is not `StatsigIntegration` + */ + public StatsigIntegration getStatsigIntegration() throws ClassCastException { + return (StatsigIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `VirusTotalIntegration`. If the actual instance is not + * `VirusTotalIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `VirusTotalIntegration` + * @throws ClassCastException if the instance is not `VirusTotalIntegration` + */ + public VirusTotalIntegration getVirusTotalIntegration() throws ClassCastException { + return (VirusTotalIntegration) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java index b4f67bb7da8..05849889db0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java @@ -128,6 +128,321 @@ public ActionConnectionIntegrationUpdate deserialize(JsonParser jp, Deserializat log.log(Level.FINER, "Input data does not match schema 'AWSIntegrationUpdate'", e); } + // deserialize AnthropicIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AnthropicIntegrationUpdate.class.equals(Integer.class) + || AnthropicIntegrationUpdate.class.equals(Long.class) + || AnthropicIntegrationUpdate.class.equals(Float.class) + || AnthropicIntegrationUpdate.class.equals(Double.class) + || AnthropicIntegrationUpdate.class.equals(Boolean.class) + || AnthropicIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AnthropicIntegrationUpdate.class.equals(Integer.class) + || AnthropicIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AnthropicIntegrationUpdate.class.equals(Float.class) + || AnthropicIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AnthropicIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AnthropicIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AnthropicIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AnthropicIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AnthropicIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AnthropicIntegrationUpdate'", e); + } + + // deserialize AsanaIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AsanaIntegrationUpdate.class.equals(Integer.class) + || AsanaIntegrationUpdate.class.equals(Long.class) + || AsanaIntegrationUpdate.class.equals(Float.class) + || AsanaIntegrationUpdate.class.equals(Double.class) + || AsanaIntegrationUpdate.class.equals(Boolean.class) + || AsanaIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AsanaIntegrationUpdate.class.equals(Integer.class) + || AsanaIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AsanaIntegrationUpdate.class.equals(Float.class) + || AsanaIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AsanaIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AsanaIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AsanaIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AsanaIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AsanaIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AsanaIntegrationUpdate'", e); + } + + // deserialize AzureIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AzureIntegrationUpdate.class.equals(Integer.class) + || AzureIntegrationUpdate.class.equals(Long.class) + || AzureIntegrationUpdate.class.equals(Float.class) + || AzureIntegrationUpdate.class.equals(Double.class) + || AzureIntegrationUpdate.class.equals(Boolean.class) + || AzureIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AzureIntegrationUpdate.class.equals(Integer.class) + || AzureIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AzureIntegrationUpdate.class.equals(Float.class) + || AzureIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AzureIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AzureIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AzureIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AzureIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AzureIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AzureIntegrationUpdate'", e); + } + + // deserialize CircleCIIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CircleCIIntegrationUpdate.class.equals(Integer.class) + || CircleCIIntegrationUpdate.class.equals(Long.class) + || CircleCIIntegrationUpdate.class.equals(Float.class) + || CircleCIIntegrationUpdate.class.equals(Double.class) + || CircleCIIntegrationUpdate.class.equals(Boolean.class) + || CircleCIIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CircleCIIntegrationUpdate.class.equals(Integer.class) + || CircleCIIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CircleCIIntegrationUpdate.class.equals(Float.class) + || CircleCIIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CircleCIIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CircleCIIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CircleCIIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CircleCIIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CircleCIIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CircleCIIntegrationUpdate'", e); + } + + // deserialize ClickupIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ClickupIntegrationUpdate.class.equals(Integer.class) + || ClickupIntegrationUpdate.class.equals(Long.class) + || ClickupIntegrationUpdate.class.equals(Float.class) + || ClickupIntegrationUpdate.class.equals(Double.class) + || ClickupIntegrationUpdate.class.equals(Boolean.class) + || ClickupIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ClickupIntegrationUpdate.class.equals(Integer.class) + || ClickupIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ClickupIntegrationUpdate.class.equals(Float.class) + || ClickupIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ClickupIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ClickupIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ClickupIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ClickupIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ClickupIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ClickupIntegrationUpdate'", e); + } + + // deserialize CloudflareIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CloudflareIntegrationUpdate.class.equals(Integer.class) + || CloudflareIntegrationUpdate.class.equals(Long.class) + || CloudflareIntegrationUpdate.class.equals(Float.class) + || CloudflareIntegrationUpdate.class.equals(Double.class) + || CloudflareIntegrationUpdate.class.equals(Boolean.class) + || CloudflareIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CloudflareIntegrationUpdate.class.equals(Integer.class) + || CloudflareIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CloudflareIntegrationUpdate.class.equals(Float.class) + || CloudflareIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CloudflareIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CloudflareIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CloudflareIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CloudflareIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CloudflareIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CloudflareIntegrationUpdate'", e); + } + + // deserialize ConfigCatIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ConfigCatIntegrationUpdate.class.equals(Integer.class) + || ConfigCatIntegrationUpdate.class.equals(Long.class) + || ConfigCatIntegrationUpdate.class.equals(Float.class) + || ConfigCatIntegrationUpdate.class.equals(Double.class) + || ConfigCatIntegrationUpdate.class.equals(Boolean.class) + || ConfigCatIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ConfigCatIntegrationUpdate.class.equals(Integer.class) + || ConfigCatIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ConfigCatIntegrationUpdate.class.equals(Float.class) + || ConfigCatIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ConfigCatIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ConfigCatIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ConfigCatIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ConfigCatIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ConfigCatIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ConfigCatIntegrationUpdate'", e); + } + // deserialize DatadogIntegrationUpdate try { boolean attemptParsing = true; @@ -173,49 +488,679 @@ public ActionConnectionIntegrationUpdate deserialize(JsonParser jp, Deserializat log.log(Level.FINER, "Input data does not match schema 'DatadogIntegrationUpdate'", e); } - // deserialize HTTPIntegrationUpdate + // deserialize FastlyIntegrationUpdate try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (HTTPIntegrationUpdate.class.equals(Integer.class) - || HTTPIntegrationUpdate.class.equals(Long.class) - || HTTPIntegrationUpdate.class.equals(Float.class) - || HTTPIntegrationUpdate.class.equals(Double.class) - || HTTPIntegrationUpdate.class.equals(Boolean.class) - || HTTPIntegrationUpdate.class.equals(String.class)) { + if (FastlyIntegrationUpdate.class.equals(Integer.class) + || FastlyIntegrationUpdate.class.equals(Long.class) + || FastlyIntegrationUpdate.class.equals(Float.class) + || FastlyIntegrationUpdate.class.equals(Double.class) + || FastlyIntegrationUpdate.class.equals(Boolean.class) + || FastlyIntegrationUpdate.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((HTTPIntegrationUpdate.class.equals(Integer.class) - || HTTPIntegrationUpdate.class.equals(Long.class)) + ((FastlyIntegrationUpdate.class.equals(Integer.class) + || FastlyIntegrationUpdate.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((HTTPIntegrationUpdate.class.equals(Float.class) - || HTTPIntegrationUpdate.class.equals(Double.class)) + ((FastlyIntegrationUpdate.class.equals(Float.class) + || FastlyIntegrationUpdate.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (HTTPIntegrationUpdate.class.equals(Boolean.class) + (FastlyIntegrationUpdate.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (HTTPIntegrationUpdate.class.equals(String.class) + (FastlyIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FastlyIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FastlyIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FastlyIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FastlyIntegrationUpdate'", e); + } + + // deserialize FreshserviceIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (FreshserviceIntegrationUpdate.class.equals(Integer.class) + || FreshserviceIntegrationUpdate.class.equals(Long.class) + || FreshserviceIntegrationUpdate.class.equals(Float.class) + || FreshserviceIntegrationUpdate.class.equals(Double.class) + || FreshserviceIntegrationUpdate.class.equals(Boolean.class) + || FreshserviceIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((FreshserviceIntegrationUpdate.class.equals(Integer.class) + || FreshserviceIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((FreshserviceIntegrationUpdate.class.equals(Float.class) + || FreshserviceIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (FreshserviceIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (FreshserviceIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FreshserviceIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FreshserviceIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FreshserviceIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FreshserviceIntegrationUpdate'", e); + } + + // deserialize GCPIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GCPIntegrationUpdate.class.equals(Integer.class) + || GCPIntegrationUpdate.class.equals(Long.class) + || GCPIntegrationUpdate.class.equals(Float.class) + || GCPIntegrationUpdate.class.equals(Double.class) + || GCPIntegrationUpdate.class.equals(Boolean.class) + || GCPIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GCPIntegrationUpdate.class.equals(Integer.class) + || GCPIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GCPIntegrationUpdate.class.equals(Float.class) + || GCPIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GCPIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GCPIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GCPIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GCPIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GCPIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GCPIntegrationUpdate'", e); + } + + // deserialize GeminiIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GeminiIntegrationUpdate.class.equals(Integer.class) + || GeminiIntegrationUpdate.class.equals(Long.class) + || GeminiIntegrationUpdate.class.equals(Float.class) + || GeminiIntegrationUpdate.class.equals(Double.class) + || GeminiIntegrationUpdate.class.equals(Boolean.class) + || GeminiIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GeminiIntegrationUpdate.class.equals(Integer.class) + || GeminiIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GeminiIntegrationUpdate.class.equals(Float.class) + || GeminiIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GeminiIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GeminiIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GeminiIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GeminiIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GeminiIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GeminiIntegrationUpdate'", e); + } + + // deserialize GitlabIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitlabIntegrationUpdate.class.equals(Integer.class) + || GitlabIntegrationUpdate.class.equals(Long.class) + || GitlabIntegrationUpdate.class.equals(Float.class) + || GitlabIntegrationUpdate.class.equals(Double.class) + || GitlabIntegrationUpdate.class.equals(Boolean.class) + || GitlabIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitlabIntegrationUpdate.class.equals(Integer.class) + || GitlabIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitlabIntegrationUpdate.class.equals(Float.class) + || GitlabIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitlabIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitlabIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GitlabIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitlabIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GitlabIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GitlabIntegrationUpdate'", e); + } + + // deserialize GreyNoiseIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GreyNoiseIntegrationUpdate.class.equals(Integer.class) + || GreyNoiseIntegrationUpdate.class.equals(Long.class) + || GreyNoiseIntegrationUpdate.class.equals(Float.class) + || GreyNoiseIntegrationUpdate.class.equals(Double.class) + || GreyNoiseIntegrationUpdate.class.equals(Boolean.class) + || GreyNoiseIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GreyNoiseIntegrationUpdate.class.equals(Integer.class) + || GreyNoiseIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GreyNoiseIntegrationUpdate.class.equals(Float.class) + || GreyNoiseIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GreyNoiseIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GreyNoiseIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GreyNoiseIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GreyNoiseIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GreyNoiseIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GreyNoiseIntegrationUpdate'", e); + } + + // deserialize HTTPIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (HTTPIntegrationUpdate.class.equals(Integer.class) + || HTTPIntegrationUpdate.class.equals(Long.class) + || HTTPIntegrationUpdate.class.equals(Float.class) + || HTTPIntegrationUpdate.class.equals(Double.class) + || HTTPIntegrationUpdate.class.equals(Boolean.class) + || HTTPIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((HTTPIntegrationUpdate.class.equals(Integer.class) + || HTTPIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((HTTPIntegrationUpdate.class.equals(Float.class) + || HTTPIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (HTTPIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (HTTPIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((HTTPIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'HTTPIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'HTTPIntegrationUpdate'", e); + } + + // deserialize LaunchDarklyIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LaunchDarklyIntegrationUpdate.class.equals(Integer.class) + || LaunchDarklyIntegrationUpdate.class.equals(Long.class) + || LaunchDarklyIntegrationUpdate.class.equals(Float.class) + || LaunchDarklyIntegrationUpdate.class.equals(Double.class) + || LaunchDarklyIntegrationUpdate.class.equals(Boolean.class) + || LaunchDarklyIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LaunchDarklyIntegrationUpdate.class.equals(Integer.class) + || LaunchDarklyIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LaunchDarklyIntegrationUpdate.class.equals(Float.class) + || LaunchDarklyIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LaunchDarklyIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LaunchDarklyIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LaunchDarklyIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LaunchDarklyIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LaunchDarklyIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LaunchDarklyIntegrationUpdate'", e); + } + + // deserialize NotionIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (NotionIntegrationUpdate.class.equals(Integer.class) + || NotionIntegrationUpdate.class.equals(Long.class) + || NotionIntegrationUpdate.class.equals(Float.class) + || NotionIntegrationUpdate.class.equals(Double.class) + || NotionIntegrationUpdate.class.equals(Boolean.class) + || NotionIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((NotionIntegrationUpdate.class.equals(Integer.class) + || NotionIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((NotionIntegrationUpdate.class.equals(Float.class) + || NotionIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (NotionIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (NotionIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(NotionIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((NotionIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'NotionIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NotionIntegrationUpdate'", e); + } + + // deserialize OktaIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OktaIntegrationUpdate.class.equals(Integer.class) + || OktaIntegrationUpdate.class.equals(Long.class) + || OktaIntegrationUpdate.class.equals(Float.class) + || OktaIntegrationUpdate.class.equals(Double.class) + || OktaIntegrationUpdate.class.equals(Boolean.class) + || OktaIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OktaIntegrationUpdate.class.equals(Integer.class) + || OktaIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OktaIntegrationUpdate.class.equals(Float.class) + || OktaIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OktaIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OktaIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OktaIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OktaIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OktaIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OktaIntegrationUpdate'", e); + } + + // deserialize OpenAIIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIIntegrationUpdate.class.equals(Integer.class) + || OpenAIIntegrationUpdate.class.equals(Long.class) + || OpenAIIntegrationUpdate.class.equals(Float.class) + || OpenAIIntegrationUpdate.class.equals(Double.class) + || OpenAIIntegrationUpdate.class.equals(Boolean.class) + || OpenAIIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIIntegrationUpdate.class.equals(Integer.class) + || OpenAIIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIIntegrationUpdate.class.equals(Float.class) + || OpenAIIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OpenAIIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OpenAIIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OpenAIIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OpenAIIntegrationUpdate'", e); + } + + // deserialize ServiceNowIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ServiceNowIntegrationUpdate.class.equals(Integer.class) + || ServiceNowIntegrationUpdate.class.equals(Long.class) + || ServiceNowIntegrationUpdate.class.equals(Float.class) + || ServiceNowIntegrationUpdate.class.equals(Double.class) + || ServiceNowIntegrationUpdate.class.equals(Boolean.class) + || ServiceNowIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ServiceNowIntegrationUpdate.class.equals(Integer.class) + || ServiceNowIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ServiceNowIntegrationUpdate.class.equals(Float.class) + || ServiceNowIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ServiceNowIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ServiceNowIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ServiceNowIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ServiceNowIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ServiceNowIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ServiceNowIntegrationUpdate'", e); + } + + // deserialize SplitIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SplitIntegrationUpdate.class.equals(Integer.class) + || SplitIntegrationUpdate.class.equals(Long.class) + || SplitIntegrationUpdate.class.equals(Float.class) + || SplitIntegrationUpdate.class.equals(Double.class) + || SplitIntegrationUpdate.class.equals(Boolean.class) + || SplitIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SplitIntegrationUpdate.class.equals(Integer.class) + || SplitIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SplitIntegrationUpdate.class.equals(Float.class) + || SplitIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SplitIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SplitIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SplitIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SplitIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SplitIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SplitIntegrationUpdate'", e); + } + + // deserialize StatsigIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (StatsigIntegrationUpdate.class.equals(Integer.class) + || StatsigIntegrationUpdate.class.equals(Long.class) + || StatsigIntegrationUpdate.class.equals(Float.class) + || StatsigIntegrationUpdate.class.equals(Double.class) + || StatsigIntegrationUpdate.class.equals(Boolean.class) + || StatsigIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((StatsigIntegrationUpdate.class.equals(Integer.class) + || StatsigIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((StatsigIntegrationUpdate.class.equals(Float.class) + || StatsigIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (StatsigIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (StatsigIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(StatsigIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((StatsigIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'StatsigIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'StatsigIntegrationUpdate'", e); + } + + // deserialize VirusTotalIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VirusTotalIntegrationUpdate.class.equals(Integer.class) + || VirusTotalIntegrationUpdate.class.equals(Long.class) + || VirusTotalIntegrationUpdate.class.equals(Float.class) + || VirusTotalIntegrationUpdate.class.equals(Double.class) + || VirusTotalIntegrationUpdate.class.equals(Boolean.class) + || VirusTotalIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VirusTotalIntegrationUpdate.class.equals(Integer.class) + || VirusTotalIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VirusTotalIntegrationUpdate.class.equals(Float.class) + || VirusTotalIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (VirusTotalIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VirusTotalIntegrationUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPIntegrationUpdate.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(VirusTotalIntegrationUpdate.class); // TODO: there is no validation against JSON schema constraints // (min, max, enum, pattern...), this does not perform a strict JSON // validation, which means the 'match' count may be higher than it should be. - if (!((HTTPIntegrationUpdate) tmp).unparsed) { + if (!((VirusTotalIntegrationUpdate) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'HTTPIntegrationUpdate'"); + log.log(Level.FINER, "Input data matches schema 'VirusTotalIntegrationUpdate'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'HTTPIntegrationUpdate'", e); + log.log(Level.FINER, "Input data does not match schema 'VirusTotalIntegrationUpdate'", e); } ActionConnectionIntegrationUpdate ret = new ActionConnectionIntegrationUpdate(); @@ -253,20 +1198,148 @@ public ActionConnectionIntegrationUpdate(AWSIntegrationUpdate o) { setActualInstance(o); } + public ActionConnectionIntegrationUpdate(AnthropicIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(AsanaIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(AzureIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(CircleCIIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(ClickupIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(CloudflareIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(ConfigCatIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ActionConnectionIntegrationUpdate(DatadogIntegrationUpdate o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } + public ActionConnectionIntegrationUpdate(FastlyIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(FreshserviceIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(GCPIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(GeminiIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(GitlabIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(GreyNoiseIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ActionConnectionIntegrationUpdate(HTTPIntegrationUpdate o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } + public ActionConnectionIntegrationUpdate(LaunchDarklyIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(NotionIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(OktaIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(OpenAIIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(ServiceNowIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(SplitIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(StatsigIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(VirusTotalIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("AWSIntegrationUpdate", new GenericType() {}); + schemas.put("AnthropicIntegrationUpdate", new GenericType() {}); + schemas.put("AsanaIntegrationUpdate", new GenericType() {}); + schemas.put("AzureIntegrationUpdate", new GenericType() {}); + schemas.put("CircleCIIntegrationUpdate", new GenericType() {}); + schemas.put("ClickupIntegrationUpdate", new GenericType() {}); + schemas.put("CloudflareIntegrationUpdate", new GenericType() {}); + schemas.put("ConfigCatIntegrationUpdate", new GenericType() {}); schemas.put("DatadogIntegrationUpdate", new GenericType() {}); + schemas.put("FastlyIntegrationUpdate", new GenericType() {}); + schemas.put( + "FreshserviceIntegrationUpdate", new GenericType() {}); + schemas.put("GCPIntegrationUpdate", new GenericType() {}); + schemas.put("GeminiIntegrationUpdate", new GenericType() {}); + schemas.put("GitlabIntegrationUpdate", new GenericType() {}); + schemas.put("GreyNoiseIntegrationUpdate", new GenericType() {}); schemas.put("HTTPIntegrationUpdate", new GenericType() {}); + schemas.put( + "LaunchDarklyIntegrationUpdate", new GenericType() {}); + schemas.put("NotionIntegrationUpdate", new GenericType() {}); + schemas.put("OktaIntegrationUpdate", new GenericType() {}); + schemas.put("OpenAIIntegrationUpdate", new GenericType() {}); + schemas.put("ServiceNowIntegrationUpdate", new GenericType() {}); + schemas.put("SplitIntegrationUpdate", new GenericType() {}); + schemas.put("StatsigIntegrationUpdate", new GenericType() {}); + schemas.put("VirusTotalIntegrationUpdate", new GenericType() {}); JSON.registerDescendants( ActionConnectionIntegrationUpdate.class, Collections.unmodifiableMap(schemas)); } @@ -278,8 +1351,15 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: AWSIntegrationUpdate, DatadogIntegrationUpdate, - * HTTPIntegrationUpdate + * against the oneOf child schemas: AWSIntegrationUpdate, AnthropicIntegrationUpdate, + * AsanaIntegrationUpdate, AzureIntegrationUpdate, CircleCIIntegrationUpdate, + * ClickupIntegrationUpdate, CloudflareIntegrationUpdate, ConfigCatIntegrationUpdate, + * DatadogIntegrationUpdate, FastlyIntegrationUpdate, FreshserviceIntegrationUpdate, + * GCPIntegrationUpdate, GeminiIntegrationUpdate, GitlabIntegrationUpdate, + * GreyNoiseIntegrationUpdate, HTTPIntegrationUpdate, LaunchDarklyIntegrationUpdate, + * NotionIntegrationUpdate, OktaIntegrationUpdate, OpenAIIntegrationUpdate, + * ServiceNowIntegrationUpdate, SplitIntegrationUpdate, StatsigIntegrationUpdate, + * VirusTotalIntegrationUpdate * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -290,30 +1370,135 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(AnthropicIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(AsanaIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(AzureIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(CircleCIIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ClickupIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(CloudflareIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ConfigCatIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(DatadogIntegrationUpdate.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(FastlyIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(FreshserviceIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GCPIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GeminiIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GitlabIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GreyNoiseIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(HTTPIntegrationUpdate.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(LaunchDarklyIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(NotionIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(OktaIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(OpenAIIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ServiceNowIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(SplitIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(StatsigIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(VirusTotalIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be AWSIntegrationUpdate, DatadogIntegrationUpdate," - + " HTTPIntegrationUpdate"); + "Invalid instance type. Must be AWSIntegrationUpdate, AnthropicIntegrationUpdate," + + " AsanaIntegrationUpdate, AzureIntegrationUpdate, CircleCIIntegrationUpdate," + + " ClickupIntegrationUpdate, CloudflareIntegrationUpdate, ConfigCatIntegrationUpdate," + + " DatadogIntegrationUpdate, FastlyIntegrationUpdate, FreshserviceIntegrationUpdate," + + " GCPIntegrationUpdate, GeminiIntegrationUpdate, GitlabIntegrationUpdate," + + " GreyNoiseIntegrationUpdate, HTTPIntegrationUpdate, LaunchDarklyIntegrationUpdate," + + " NotionIntegrationUpdate, OktaIntegrationUpdate, OpenAIIntegrationUpdate," + + " ServiceNowIntegrationUpdate, SplitIntegrationUpdate, StatsigIntegrationUpdate," + + " VirusTotalIntegrationUpdate"); } /** * Get the actual instance, which can be the following: AWSIntegrationUpdate, - * DatadogIntegrationUpdate, HTTPIntegrationUpdate + * AnthropicIntegrationUpdate, AsanaIntegrationUpdate, AzureIntegrationUpdate, + * CircleCIIntegrationUpdate, ClickupIntegrationUpdate, CloudflareIntegrationUpdate, + * ConfigCatIntegrationUpdate, DatadogIntegrationUpdate, FastlyIntegrationUpdate, + * FreshserviceIntegrationUpdate, GCPIntegrationUpdate, GeminiIntegrationUpdate, + * GitlabIntegrationUpdate, GreyNoiseIntegrationUpdate, HTTPIntegrationUpdate, + * LaunchDarklyIntegrationUpdate, NotionIntegrationUpdate, OktaIntegrationUpdate, + * OpenAIIntegrationUpdate, ServiceNowIntegrationUpdate, SplitIntegrationUpdate, + * StatsigIntegrationUpdate, VirusTotalIntegrationUpdate * - * @return The actual instance (AWSIntegrationUpdate, DatadogIntegrationUpdate, - * HTTPIntegrationUpdate) + * @return The actual instance (AWSIntegrationUpdate, AnthropicIntegrationUpdate, + * AsanaIntegrationUpdate, AzureIntegrationUpdate, CircleCIIntegrationUpdate, + * ClickupIntegrationUpdate, CloudflareIntegrationUpdate, ConfigCatIntegrationUpdate, + * DatadogIntegrationUpdate, FastlyIntegrationUpdate, FreshserviceIntegrationUpdate, + * GCPIntegrationUpdate, GeminiIntegrationUpdate, GitlabIntegrationUpdate, + * GreyNoiseIntegrationUpdate, HTTPIntegrationUpdate, LaunchDarklyIntegrationUpdate, + * NotionIntegrationUpdate, OktaIntegrationUpdate, OpenAIIntegrationUpdate, + * ServiceNowIntegrationUpdate, SplitIntegrationUpdate, StatsigIntegrationUpdate, + * VirusTotalIntegrationUpdate) */ @Override public Object getActualInstance() { @@ -331,6 +1516,83 @@ public AWSIntegrationUpdate getAWSIntegrationUpdate() throws ClassCastException return (AWSIntegrationUpdate) super.getActualInstance(); } + /** + * Get the actual instance of `AnthropicIntegrationUpdate`. If the actual instance is not + * `AnthropicIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AnthropicIntegrationUpdate` + * @throws ClassCastException if the instance is not `AnthropicIntegrationUpdate` + */ + public AnthropicIntegrationUpdate getAnthropicIntegrationUpdate() throws ClassCastException { + return (AnthropicIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `AsanaIntegrationUpdate`. If the actual instance is not + * `AsanaIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AsanaIntegrationUpdate` + * @throws ClassCastException if the instance is not `AsanaIntegrationUpdate` + */ + public AsanaIntegrationUpdate getAsanaIntegrationUpdate() throws ClassCastException { + return (AsanaIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `AzureIntegrationUpdate`. If the actual instance is not + * `AzureIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AzureIntegrationUpdate` + * @throws ClassCastException if the instance is not `AzureIntegrationUpdate` + */ + public AzureIntegrationUpdate getAzureIntegrationUpdate() throws ClassCastException { + return (AzureIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `CircleCIIntegrationUpdate`. If the actual instance is not + * `CircleCIIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `CircleCIIntegrationUpdate` + * @throws ClassCastException if the instance is not `CircleCIIntegrationUpdate` + */ + public CircleCIIntegrationUpdate getCircleCIIntegrationUpdate() throws ClassCastException { + return (CircleCIIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `ClickupIntegrationUpdate`. If the actual instance is not + * `ClickupIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `ClickupIntegrationUpdate` + * @throws ClassCastException if the instance is not `ClickupIntegrationUpdate` + */ + public ClickupIntegrationUpdate getClickupIntegrationUpdate() throws ClassCastException { + return (ClickupIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `CloudflareIntegrationUpdate`. If the actual instance is not + * `CloudflareIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `CloudflareIntegrationUpdate` + * @throws ClassCastException if the instance is not `CloudflareIntegrationUpdate` + */ + public CloudflareIntegrationUpdate getCloudflareIntegrationUpdate() throws ClassCastException { + return (CloudflareIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `ConfigCatIntegrationUpdate`. If the actual instance is not + * `ConfigCatIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `ConfigCatIntegrationUpdate` + * @throws ClassCastException if the instance is not `ConfigCatIntegrationUpdate` + */ + public ConfigCatIntegrationUpdate getConfigCatIntegrationUpdate() throws ClassCastException { + return (ConfigCatIntegrationUpdate) super.getActualInstance(); + } + /** * Get the actual instance of `DatadogIntegrationUpdate`. If the actual instance is not * `DatadogIntegrationUpdate`, the ClassCastException will be thrown. @@ -342,6 +1604,73 @@ public DatadogIntegrationUpdate getDatadogIntegrationUpdate() throws ClassCastEx return (DatadogIntegrationUpdate) super.getActualInstance(); } + /** + * Get the actual instance of `FastlyIntegrationUpdate`. If the actual instance is not + * `FastlyIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `FastlyIntegrationUpdate` + * @throws ClassCastException if the instance is not `FastlyIntegrationUpdate` + */ + public FastlyIntegrationUpdate getFastlyIntegrationUpdate() throws ClassCastException { + return (FastlyIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `FreshserviceIntegrationUpdate`. If the actual instance is not + * `FreshserviceIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `FreshserviceIntegrationUpdate` + * @throws ClassCastException if the instance is not `FreshserviceIntegrationUpdate` + */ + public FreshserviceIntegrationUpdate getFreshserviceIntegrationUpdate() + throws ClassCastException { + return (FreshserviceIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `GCPIntegrationUpdate`. If the actual instance is not + * `GCPIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GCPIntegrationUpdate` + * @throws ClassCastException if the instance is not `GCPIntegrationUpdate` + */ + public GCPIntegrationUpdate getGCPIntegrationUpdate() throws ClassCastException { + return (GCPIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `GeminiIntegrationUpdate`. If the actual instance is not + * `GeminiIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GeminiIntegrationUpdate` + * @throws ClassCastException if the instance is not `GeminiIntegrationUpdate` + */ + public GeminiIntegrationUpdate getGeminiIntegrationUpdate() throws ClassCastException { + return (GeminiIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `GitlabIntegrationUpdate`. If the actual instance is not + * `GitlabIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GitlabIntegrationUpdate` + * @throws ClassCastException if the instance is not `GitlabIntegrationUpdate` + */ + public GitlabIntegrationUpdate getGitlabIntegrationUpdate() throws ClassCastException { + return (GitlabIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `GreyNoiseIntegrationUpdate`. If the actual instance is not + * `GreyNoiseIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GreyNoiseIntegrationUpdate` + * @throws ClassCastException if the instance is not `GreyNoiseIntegrationUpdate` + */ + public GreyNoiseIntegrationUpdate getGreyNoiseIntegrationUpdate() throws ClassCastException { + return (GreyNoiseIntegrationUpdate) super.getActualInstance(); + } + /** * Get the actual instance of `HTTPIntegrationUpdate`. If the actual instance is not * `HTTPIntegrationUpdate`, the ClassCastException will be thrown. @@ -352,4 +1681,93 @@ public DatadogIntegrationUpdate getDatadogIntegrationUpdate() throws ClassCastEx public HTTPIntegrationUpdate getHTTPIntegrationUpdate() throws ClassCastException { return (HTTPIntegrationUpdate) super.getActualInstance(); } + + /** + * Get the actual instance of `LaunchDarklyIntegrationUpdate`. If the actual instance is not + * `LaunchDarklyIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `LaunchDarklyIntegrationUpdate` + * @throws ClassCastException if the instance is not `LaunchDarklyIntegrationUpdate` + */ + public LaunchDarklyIntegrationUpdate getLaunchDarklyIntegrationUpdate() + throws ClassCastException { + return (LaunchDarklyIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `NotionIntegrationUpdate`. If the actual instance is not + * `NotionIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `NotionIntegrationUpdate` + * @throws ClassCastException if the instance is not `NotionIntegrationUpdate` + */ + public NotionIntegrationUpdate getNotionIntegrationUpdate() throws ClassCastException { + return (NotionIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `OktaIntegrationUpdate`. If the actual instance is not + * `OktaIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `OktaIntegrationUpdate` + * @throws ClassCastException if the instance is not `OktaIntegrationUpdate` + */ + public OktaIntegrationUpdate getOktaIntegrationUpdate() throws ClassCastException { + return (OktaIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIIntegrationUpdate`. If the actual instance is not + * `OpenAIIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIIntegrationUpdate` + * @throws ClassCastException if the instance is not `OpenAIIntegrationUpdate` + */ + public OpenAIIntegrationUpdate getOpenAIIntegrationUpdate() throws ClassCastException { + return (OpenAIIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `ServiceNowIntegrationUpdate`. If the actual instance is not + * `ServiceNowIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `ServiceNowIntegrationUpdate` + * @throws ClassCastException if the instance is not `ServiceNowIntegrationUpdate` + */ + public ServiceNowIntegrationUpdate getServiceNowIntegrationUpdate() throws ClassCastException { + return (ServiceNowIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `SplitIntegrationUpdate`. If the actual instance is not + * `SplitIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `SplitIntegrationUpdate` + * @throws ClassCastException if the instance is not `SplitIntegrationUpdate` + */ + public SplitIntegrationUpdate getSplitIntegrationUpdate() throws ClassCastException { + return (SplitIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `StatsigIntegrationUpdate`. If the actual instance is not + * `StatsigIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `StatsigIntegrationUpdate` + * @throws ClassCastException if the instance is not `StatsigIntegrationUpdate` + */ + public StatsigIntegrationUpdate getStatsigIntegrationUpdate() throws ClassCastException { + return (StatsigIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `VirusTotalIntegrationUpdate`. If the actual instance is not + * `VirusTotalIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `VirusTotalIntegrationUpdate` + * @throws ClassCastException if the instance is not `VirusTotalIntegrationUpdate` + */ + public VirusTotalIntegrationUpdate getVirusTotalIntegrationUpdate() throws ClassCastException { + return (VirusTotalIntegrationUpdate) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKey.java new file mode 100644 index 00000000000..6bdc0af7e2e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AnthropicAPIKey object. */ +@JsonPropertyOrder({AnthropicAPIKey.JSON_PROPERTY_API_TOKEN, AnthropicAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnthropicAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnthropicAPIKeyType type; + + public AnthropicAPIKey() {} + + @JsonCreator + public AnthropicAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnthropicAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnthropicAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The AnthropicAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public AnthropicAPIKey type(AnthropicAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AnthropicAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnthropicAPIKeyType getType() { + return type; + } + + public void setType(AnthropicAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AnthropicAPIKey + */ + @JsonAnySetter + public AnthropicAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AnthropicAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnthropicAPIKey anthropicApiKey = (AnthropicAPIKey) o; + return Objects.equals(this.apiToken, anthropicApiKey.apiToken) + && Objects.equals(this.type, anthropicApiKey.type) + && Objects.equals(this.additionalProperties, anthropicApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnthropicAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKeyType.java new file mode 100644 index 00000000000..041f7b114da --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKeyType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the AnthropicAPIKey object. */ +@JsonSerialize(using = AnthropicAPIKeyType.AnthropicAPIKeyTypeSerializer.class) +public class AnthropicAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("AnthropicAPIKey")); + + public static final AnthropicAPIKeyType ANTHROPICAPIKEY = + new AnthropicAPIKeyType("AnthropicAPIKey"); + + AnthropicAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class AnthropicAPIKeyTypeSerializer extends StdSerializer { + public AnthropicAPIKeyTypeSerializer(Class t) { + super(t); + } + + public AnthropicAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AnthropicAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnthropicAPIKeyType fromValue(String value) { + return new AnthropicAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKeyUpdate.java new file mode 100644 index 00000000000..5979c73c6b1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AnthropicAPIKey object. */ +@JsonPropertyOrder({ + AnthropicAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + AnthropicAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnthropicAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnthropicAPIKeyType type; + + public AnthropicAPIKeyUpdate() {} + + @JsonCreator + public AnthropicAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnthropicAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnthropicAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The AnthropicAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public AnthropicAPIKeyUpdate type(AnthropicAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AnthropicAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnthropicAPIKeyType getType() { + return type; + } + + public void setType(AnthropicAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AnthropicAPIKeyUpdate + */ + @JsonAnySetter + public AnthropicAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AnthropicAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnthropicAPIKeyUpdate anthropicApiKeyUpdate = (AnthropicAPIKeyUpdate) o; + return Objects.equals(this.apiToken, anthropicApiKeyUpdate.apiToken) + && Objects.equals(this.type, anthropicApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, anthropicApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnthropicAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicCredentials.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicCredentials.java new file mode 100644 index 00000000000..72b626f4cf3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicCredentials.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AnthropicCredentials.AnthropicCredentialsDeserializer.class) +@JsonSerialize(using = AnthropicCredentials.AnthropicCredentialsSerializer.class) +public class AnthropicCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AnthropicCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AnthropicCredentialsSerializer extends StdSerializer { + public AnthropicCredentialsSerializer(Class t) { + super(t); + } + + public AnthropicCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + AnthropicCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AnthropicCredentialsDeserializer + extends StdDeserializer { + public AnthropicCredentialsDeserializer() { + this(AnthropicCredentials.class); + } + + public AnthropicCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public AnthropicCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AnthropicAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AnthropicAPIKey.class.equals(Integer.class) + || AnthropicAPIKey.class.equals(Long.class) + || AnthropicAPIKey.class.equals(Float.class) + || AnthropicAPIKey.class.equals(Double.class) + || AnthropicAPIKey.class.equals(Boolean.class) + || AnthropicAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AnthropicAPIKey.class.equals(Integer.class) + || AnthropicAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AnthropicAPIKey.class.equals(Float.class) + || AnthropicAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AnthropicAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AnthropicAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AnthropicAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AnthropicAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AnthropicAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AnthropicAPIKey'", e); + } + + AnthropicCredentials ret = new AnthropicCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AnthropicCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AnthropicCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AnthropicCredentials() { + super("oneOf", Boolean.FALSE); + } + + public AnthropicCredentials(AnthropicAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AnthropicAPIKey", new GenericType() {}); + JSON.registerDescendants(AnthropicCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AnthropicCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AnthropicAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AnthropicAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AnthropicAPIKey"); + } + + /** + * Get the actual instance, which can be the following: AnthropicAPIKey + * + * @return The actual instance (AnthropicAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AnthropicAPIKey`. If the actual instance is not `AnthropicAPIKey`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AnthropicAPIKey` + * @throws ClassCastException if the instance is not `AnthropicAPIKey` + */ + public AnthropicAPIKey getAnthropicAPIKey() throws ClassCastException { + return (AnthropicAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicCredentialsUpdate.java new file mode 100644 index 00000000000..99dbaeff3b2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicCredentialsUpdate.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AnthropicCredentialsUpdate.AnthropicCredentialsUpdateDeserializer.class) +@JsonSerialize(using = AnthropicCredentialsUpdate.AnthropicCredentialsUpdateSerializer.class) +public class AnthropicCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AnthropicCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AnthropicCredentialsUpdateSerializer + extends StdSerializer { + public AnthropicCredentialsUpdateSerializer(Class t) { + super(t); + } + + public AnthropicCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + AnthropicCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AnthropicCredentialsUpdateDeserializer + extends StdDeserializer { + public AnthropicCredentialsUpdateDeserializer() { + this(AnthropicCredentialsUpdate.class); + } + + public AnthropicCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public AnthropicCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AnthropicAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AnthropicAPIKeyUpdate.class.equals(Integer.class) + || AnthropicAPIKeyUpdate.class.equals(Long.class) + || AnthropicAPIKeyUpdate.class.equals(Float.class) + || AnthropicAPIKeyUpdate.class.equals(Double.class) + || AnthropicAPIKeyUpdate.class.equals(Boolean.class) + || AnthropicAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AnthropicAPIKeyUpdate.class.equals(Integer.class) + || AnthropicAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AnthropicAPIKeyUpdate.class.equals(Float.class) + || AnthropicAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AnthropicAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AnthropicAPIKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AnthropicAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AnthropicAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AnthropicAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AnthropicAPIKeyUpdate'", e); + } + + AnthropicCredentialsUpdate ret = new AnthropicCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AnthropicCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AnthropicCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AnthropicCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public AnthropicCredentialsUpdate(AnthropicAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AnthropicAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants( + AnthropicCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AnthropicCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AnthropicAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AnthropicAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AnthropicAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: AnthropicAPIKeyUpdate + * + * @return The actual instance (AnthropicAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AnthropicAPIKeyUpdate`. If the actual instance is not + * `AnthropicAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AnthropicAPIKeyUpdate` + * @throws ClassCastException if the instance is not `AnthropicAPIKeyUpdate` + */ + public AnthropicAPIKeyUpdate getAnthropicAPIKeyUpdate() throws ClassCastException { + return (AnthropicAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegration.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegration.java new file mode 100644 index 00000000000..a010cc69b69 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AnthropicIntegration object. */ +@JsonPropertyOrder({ + AnthropicIntegration.JSON_PROPERTY_CREDENTIALS, + AnthropicIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnthropicIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AnthropicCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnthropicIntegrationType type; + + public AnthropicIntegration() {} + + @JsonCreator + public AnthropicIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + AnthropicCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnthropicIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnthropicIntegration credentials(AnthropicCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the AnthropicCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnthropicCredentials getCredentials() { + return credentials; + } + + public void setCredentials(AnthropicCredentials credentials) { + this.credentials = credentials; + } + + public AnthropicIntegration type(AnthropicIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AnthropicIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnthropicIntegrationType getType() { + return type; + } + + public void setType(AnthropicIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AnthropicIntegration + */ + @JsonAnySetter + public AnthropicIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AnthropicIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnthropicIntegration anthropicIntegration = (AnthropicIntegration) o; + return Objects.equals(this.credentials, anthropicIntegration.credentials) + && Objects.equals(this.type, anthropicIntegration.type) + && Objects.equals(this.additionalProperties, anthropicIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnthropicIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegrationType.java new file mode 100644 index 00000000000..4a9d697f04b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegrationType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the AnthropicIntegrationType object. */ +@JsonSerialize(using = AnthropicIntegrationType.AnthropicIntegrationTypeSerializer.class) +public class AnthropicIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Anthropic")); + + public static final AnthropicIntegrationType ANTHROPIC = + new AnthropicIntegrationType("Anthropic"); + + AnthropicIntegrationType(String value) { + super(value, allowedValues); + } + + public static class AnthropicIntegrationTypeSerializer + extends StdSerializer { + public AnthropicIntegrationTypeSerializer(Class t) { + super(t); + } + + public AnthropicIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AnthropicIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnthropicIntegrationType fromValue(String value) { + return new AnthropicIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegrationUpdate.java new file mode 100644 index 00000000000..3f68e8c59e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnthropicIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AnthropicIntegrationUpdate object. */ +@JsonPropertyOrder({ + AnthropicIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + AnthropicIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnthropicIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AnthropicCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnthropicIntegrationType type; + + public AnthropicIntegrationUpdate() {} + + @JsonCreator + public AnthropicIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnthropicIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnthropicIntegrationUpdate credentials(AnthropicCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the AnthropicCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AnthropicCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(AnthropicCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public AnthropicIntegrationUpdate type(AnthropicIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AnthropicIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnthropicIntegrationType getType() { + return type; + } + + public void setType(AnthropicIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AnthropicIntegrationUpdate + */ + @JsonAnySetter + public AnthropicIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AnthropicIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnthropicIntegrationUpdate anthropicIntegrationUpdate = (AnthropicIntegrationUpdate) o; + return Objects.equals(this.credentials, anthropicIntegrationUpdate.credentials) + && Objects.equals(this.type, anthropicIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, anthropicIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnthropicIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaAccessToken.java b/src/main/java/com/datadog/api/client/v2/model/AsanaAccessToken.java new file mode 100644 index 00000000000..5c775d5ee60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaAccessToken.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AsanaAccessToken object. */ +@JsonPropertyOrder({ + AsanaAccessToken.JSON_PROPERTY_ACCESS_TOKEN, + AsanaAccessToken.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AsanaAccessToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESS_TOKEN = "access_token"; + private String accessToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AsanaAccessTokenType type; + + public AsanaAccessToken() {} + + @JsonCreator + public AsanaAccessToken( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCESS_TOKEN) String accessToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AsanaAccessTokenType type) { + this.accessToken = accessToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AsanaAccessToken accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * The AsanaAccessToken access_token. + * + * @return accessToken + */ + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public AsanaAccessToken type(AsanaAccessTokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AsanaAccessToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AsanaAccessTokenType getType() { + return type; + } + + public void setType(AsanaAccessTokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AsanaAccessToken + */ + @JsonAnySetter + public AsanaAccessToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AsanaAccessToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AsanaAccessToken asanaAccessToken = (AsanaAccessToken) o; + return Objects.equals(this.accessToken, asanaAccessToken.accessToken) + && Objects.equals(this.type, asanaAccessToken.type) + && Objects.equals(this.additionalProperties, asanaAccessToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accessToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AsanaAccessToken {\n"); + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaAccessTokenType.java b/src/main/java/com/datadog/api/client/v2/model/AsanaAccessTokenType.java new file mode 100644 index 00000000000..b266c8937b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaAccessTokenType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the AsanaAccessToken object. */ +@JsonSerialize(using = AsanaAccessTokenType.AsanaAccessTokenTypeSerializer.class) +public class AsanaAccessTokenType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("AsanaAccessToken")); + + public static final AsanaAccessTokenType ASANAACCESSTOKEN = + new AsanaAccessTokenType("AsanaAccessToken"); + + AsanaAccessTokenType(String value) { + super(value, allowedValues); + } + + public static class AsanaAccessTokenTypeSerializer extends StdSerializer { + public AsanaAccessTokenTypeSerializer(Class t) { + super(t); + } + + public AsanaAccessTokenTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AsanaAccessTokenType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AsanaAccessTokenType fromValue(String value) { + return new AsanaAccessTokenType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaAccessTokenUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AsanaAccessTokenUpdate.java new file mode 100644 index 00000000000..15509f9958e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaAccessTokenUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AsanaAccessToken object. */ +@JsonPropertyOrder({ + AsanaAccessTokenUpdate.JSON_PROPERTY_ACCESS_TOKEN, + AsanaAccessTokenUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AsanaAccessTokenUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESS_TOKEN = "access_token"; + private String accessToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AsanaAccessTokenType type; + + public AsanaAccessTokenUpdate() {} + + @JsonCreator + public AsanaAccessTokenUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AsanaAccessTokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AsanaAccessTokenUpdate accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * The AsanaAccessTokenUpdate access_token. + * + * @return accessToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public AsanaAccessTokenUpdate type(AsanaAccessTokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AsanaAccessToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AsanaAccessTokenType getType() { + return type; + } + + public void setType(AsanaAccessTokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AsanaAccessTokenUpdate + */ + @JsonAnySetter + public AsanaAccessTokenUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AsanaAccessTokenUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AsanaAccessTokenUpdate asanaAccessTokenUpdate = (AsanaAccessTokenUpdate) o; + return Objects.equals(this.accessToken, asanaAccessTokenUpdate.accessToken) + && Objects.equals(this.type, asanaAccessTokenUpdate.type) + && Objects.equals(this.additionalProperties, asanaAccessTokenUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accessToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AsanaAccessTokenUpdate {\n"); + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaCredentials.java b/src/main/java/com/datadog/api/client/v2/model/AsanaCredentials.java new file mode 100644 index 00000000000..0da7461ade6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaCredentials.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AsanaCredentials.AsanaCredentialsDeserializer.class) +@JsonSerialize(using = AsanaCredentials.AsanaCredentialsSerializer.class) +public class AsanaCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AsanaCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AsanaCredentialsSerializer extends StdSerializer { + public AsanaCredentialsSerializer(Class t) { + super(t); + } + + public AsanaCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(AsanaCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AsanaCredentialsDeserializer extends StdDeserializer { + public AsanaCredentialsDeserializer() { + this(AsanaCredentials.class); + } + + public AsanaCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public AsanaCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AsanaAccessToken + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AsanaAccessToken.class.equals(Integer.class) + || AsanaAccessToken.class.equals(Long.class) + || AsanaAccessToken.class.equals(Float.class) + || AsanaAccessToken.class.equals(Double.class) + || AsanaAccessToken.class.equals(Boolean.class) + || AsanaAccessToken.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AsanaAccessToken.class.equals(Integer.class) + || AsanaAccessToken.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AsanaAccessToken.class.equals(Float.class) + || AsanaAccessToken.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AsanaAccessToken.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AsanaAccessToken.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AsanaAccessToken.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AsanaAccessToken) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AsanaAccessToken'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AsanaAccessToken'", e); + } + + AsanaCredentials ret = new AsanaCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AsanaCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AsanaCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AsanaCredentials() { + super("oneOf", Boolean.FALSE); + } + + public AsanaCredentials(AsanaAccessToken o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AsanaAccessToken", new GenericType() {}); + JSON.registerDescendants(AsanaCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AsanaCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AsanaAccessToken + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AsanaAccessToken.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AsanaAccessToken"); + } + + /** + * Get the actual instance, which can be the following: AsanaAccessToken + * + * @return The actual instance (AsanaAccessToken) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AsanaAccessToken`. If the actual instance is not + * `AsanaAccessToken`, the ClassCastException will be thrown. + * + * @return The actual instance of `AsanaAccessToken` + * @throws ClassCastException if the instance is not `AsanaAccessToken` + */ + public AsanaAccessToken getAsanaAccessToken() throws ClassCastException { + return (AsanaAccessToken) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AsanaCredentialsUpdate.java new file mode 100644 index 00000000000..70508634e91 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaCredentialsUpdate.java @@ -0,0 +1,213 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AsanaCredentialsUpdate.AsanaCredentialsUpdateDeserializer.class) +@JsonSerialize(using = AsanaCredentialsUpdate.AsanaCredentialsUpdateSerializer.class) +public class AsanaCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AsanaCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AsanaCredentialsUpdateSerializer + extends StdSerializer { + public AsanaCredentialsUpdateSerializer(Class t) { + super(t); + } + + public AsanaCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + AsanaCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AsanaCredentialsUpdateDeserializer + extends StdDeserializer { + public AsanaCredentialsUpdateDeserializer() { + this(AsanaCredentialsUpdate.class); + } + + public AsanaCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public AsanaCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AsanaAccessTokenUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AsanaAccessTokenUpdate.class.equals(Integer.class) + || AsanaAccessTokenUpdate.class.equals(Long.class) + || AsanaAccessTokenUpdate.class.equals(Float.class) + || AsanaAccessTokenUpdate.class.equals(Double.class) + || AsanaAccessTokenUpdate.class.equals(Boolean.class) + || AsanaAccessTokenUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AsanaAccessTokenUpdate.class.equals(Integer.class) + || AsanaAccessTokenUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AsanaAccessTokenUpdate.class.equals(Float.class) + || AsanaAccessTokenUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AsanaAccessTokenUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AsanaAccessTokenUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AsanaAccessTokenUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AsanaAccessTokenUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AsanaAccessTokenUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AsanaAccessTokenUpdate'", e); + } + + AsanaCredentialsUpdate ret = new AsanaCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AsanaCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AsanaCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AsanaCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public AsanaCredentialsUpdate(AsanaAccessTokenUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AsanaAccessTokenUpdate", new GenericType() {}); + JSON.registerDescendants(AsanaCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AsanaCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AsanaAccessTokenUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AsanaAccessTokenUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AsanaAccessTokenUpdate"); + } + + /** + * Get the actual instance, which can be the following: AsanaAccessTokenUpdate + * + * @return The actual instance (AsanaAccessTokenUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AsanaAccessTokenUpdate`. If the actual instance is not + * `AsanaAccessTokenUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AsanaAccessTokenUpdate` + * @throws ClassCastException if the instance is not `AsanaAccessTokenUpdate` + */ + public AsanaAccessTokenUpdate getAsanaAccessTokenUpdate() throws ClassCastException { + return (AsanaAccessTokenUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaIntegration.java b/src/main/java/com/datadog/api/client/v2/model/AsanaIntegration.java new file mode 100644 index 00000000000..d1ffd444274 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AsanaIntegration object. */ +@JsonPropertyOrder({ + AsanaIntegration.JSON_PROPERTY_CREDENTIALS, + AsanaIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AsanaIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AsanaCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AsanaIntegrationType type; + + public AsanaIntegration() {} + + @JsonCreator + public AsanaIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + AsanaCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AsanaIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AsanaIntegration credentials(AsanaCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the AsanaCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AsanaCredentials getCredentials() { + return credentials; + } + + public void setCredentials(AsanaCredentials credentials) { + this.credentials = credentials; + } + + public AsanaIntegration type(AsanaIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AsanaIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AsanaIntegrationType getType() { + return type; + } + + public void setType(AsanaIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AsanaIntegration + */ + @JsonAnySetter + public AsanaIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AsanaIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AsanaIntegration asanaIntegration = (AsanaIntegration) o; + return Objects.equals(this.credentials, asanaIntegration.credentials) + && Objects.equals(this.type, asanaIntegration.type) + && Objects.equals(this.additionalProperties, asanaIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AsanaIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/AsanaIntegrationType.java new file mode 100644 index 00000000000..4dfb3593eb2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the AsanaIntegrationType object. */ +@JsonSerialize(using = AsanaIntegrationType.AsanaIntegrationTypeSerializer.class) +public class AsanaIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Asana")); + + public static final AsanaIntegrationType ASANA = new AsanaIntegrationType("Asana"); + + AsanaIntegrationType(String value) { + super(value, allowedValues); + } + + public static class AsanaIntegrationTypeSerializer extends StdSerializer { + public AsanaIntegrationTypeSerializer(Class t) { + super(t); + } + + public AsanaIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AsanaIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AsanaIntegrationType fromValue(String value) { + return new AsanaIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AsanaIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AsanaIntegrationUpdate.java new file mode 100644 index 00000000000..6f559775e6b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AsanaIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AsanaIntegrationUpdate object. */ +@JsonPropertyOrder({ + AsanaIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + AsanaIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AsanaIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AsanaCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AsanaIntegrationType type; + + public AsanaIntegrationUpdate() {} + + @JsonCreator + public AsanaIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AsanaIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AsanaIntegrationUpdate credentials(AsanaCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the AsanaCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AsanaCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(AsanaCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public AsanaIntegrationUpdate type(AsanaIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AsanaIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AsanaIntegrationType getType() { + return type; + } + + public void setType(AsanaIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AsanaIntegrationUpdate + */ + @JsonAnySetter + public AsanaIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AsanaIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AsanaIntegrationUpdate asanaIntegrationUpdate = (AsanaIntegrationUpdate) o; + return Objects.equals(this.credentials, asanaIntegrationUpdate.credentials) + && Objects.equals(this.type, asanaIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, asanaIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AsanaIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureCredentials.java b/src/main/java/com/datadog/api/client/v2/model/AzureCredentials.java new file mode 100644 index 00000000000..972b47a5125 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AzureCredentials.AzureCredentialsDeserializer.class) +@JsonSerialize(using = AzureCredentials.AzureCredentialsSerializer.class) +public class AzureCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AzureCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AzureCredentialsSerializer extends StdSerializer { + public AzureCredentialsSerializer(Class t) { + super(t); + } + + public AzureCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(AzureCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AzureCredentialsDeserializer extends StdDeserializer { + public AzureCredentialsDeserializer() { + this(AzureCredentials.class); + } + + public AzureCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public AzureCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AzureTenant + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AzureTenant.class.equals(Integer.class) + || AzureTenant.class.equals(Long.class) + || AzureTenant.class.equals(Float.class) + || AzureTenant.class.equals(Double.class) + || AzureTenant.class.equals(Boolean.class) + || AzureTenant.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AzureTenant.class.equals(Integer.class) || AzureTenant.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AzureTenant.class.equals(Float.class) || AzureTenant.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AzureTenant.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AzureTenant.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AzureTenant.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AzureTenant) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AzureTenant'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AzureTenant'", e); + } + + AzureCredentials ret = new AzureCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AzureCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AzureCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AzureCredentials() { + super("oneOf", Boolean.FALSE); + } + + public AzureCredentials(AzureTenant o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AzureTenant", new GenericType() {}); + JSON.registerDescendants(AzureCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AzureCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AzureTenant + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AzureTenant.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AzureTenant"); + } + + /** + * Get the actual instance, which can be the following: AzureTenant + * + * @return The actual instance (AzureTenant) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AzureTenant`. If the actual instance is not `AzureTenant`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `AzureTenant` + * @throws ClassCastException if the instance is not `AzureTenant` + */ + public AzureTenant getAzureTenant() throws ClassCastException { + return (AzureTenant) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AzureCredentialsUpdate.java new file mode 100644 index 00000000000..ca225f98b59 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AzureCredentialsUpdate.AzureCredentialsUpdateDeserializer.class) +@JsonSerialize(using = AzureCredentialsUpdate.AzureCredentialsUpdateSerializer.class) +public class AzureCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AzureCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AzureCredentialsUpdateSerializer + extends StdSerializer { + public AzureCredentialsUpdateSerializer(Class t) { + super(t); + } + + public AzureCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + AzureCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AzureCredentialsUpdateDeserializer + extends StdDeserializer { + public AzureCredentialsUpdateDeserializer() { + this(AzureCredentialsUpdate.class); + } + + public AzureCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public AzureCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AzureTenantUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AzureTenantUpdate.class.equals(Integer.class) + || AzureTenantUpdate.class.equals(Long.class) + || AzureTenantUpdate.class.equals(Float.class) + || AzureTenantUpdate.class.equals(Double.class) + || AzureTenantUpdate.class.equals(Boolean.class) + || AzureTenantUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AzureTenantUpdate.class.equals(Integer.class) + || AzureTenantUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AzureTenantUpdate.class.equals(Float.class) + || AzureTenantUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AzureTenantUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AzureTenantUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AzureTenantUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AzureTenantUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AzureTenantUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AzureTenantUpdate'", e); + } + + AzureCredentialsUpdate ret = new AzureCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AzureCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AzureCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AzureCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public AzureCredentialsUpdate(AzureTenantUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AzureTenantUpdate", new GenericType() {}); + JSON.registerDescendants(AzureCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AzureCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AzureTenantUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AzureTenantUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AzureTenantUpdate"); + } + + /** + * Get the actual instance, which can be the following: AzureTenantUpdate + * + * @return The actual instance (AzureTenantUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AzureTenantUpdate`. If the actual instance is not + * `AzureTenantUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AzureTenantUpdate` + * @throws ClassCastException if the instance is not `AzureTenantUpdate` + */ + public AzureTenantUpdate getAzureTenantUpdate() throws ClassCastException { + return (AzureTenantUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureIntegration.java b/src/main/java/com/datadog/api/client/v2/model/AzureIntegration.java new file mode 100644 index 00000000000..14bc198591b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AzureIntegration object. */ +@JsonPropertyOrder({ + AzureIntegration.JSON_PROPERTY_CREDENTIALS, + AzureIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AzureIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AzureCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AzureIntegrationType type; + + public AzureIntegration() {} + + @JsonCreator + public AzureIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + AzureCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AzureIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AzureIntegration credentials(AzureCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the AzureCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AzureCredentials getCredentials() { + return credentials; + } + + public void setCredentials(AzureCredentials credentials) { + this.credentials = credentials; + } + + public AzureIntegration type(AzureIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AzureIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AzureIntegrationType getType() { + return type; + } + + public void setType(AzureIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AzureIntegration + */ + @JsonAnySetter + public AzureIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AzureIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AzureIntegration azureIntegration = (AzureIntegration) o; + return Objects.equals(this.credentials, azureIntegration.credentials) + && Objects.equals(this.type, azureIntegration.type) + && Objects.equals(this.additionalProperties, azureIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AzureIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/AzureIntegrationType.java new file mode 100644 index 00000000000..2516eff2897 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the AzureIntegrationType object. */ +@JsonSerialize(using = AzureIntegrationType.AzureIntegrationTypeSerializer.class) +public class AzureIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Azure")); + + public static final AzureIntegrationType AZURE = new AzureIntegrationType("Azure"); + + AzureIntegrationType(String value) { + super(value, allowedValues); + } + + public static class AzureIntegrationTypeSerializer extends StdSerializer { + public AzureIntegrationTypeSerializer(Class t) { + super(t); + } + + public AzureIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AzureIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AzureIntegrationType fromValue(String value) { + return new AzureIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AzureIntegrationUpdate.java new file mode 100644 index 00000000000..4c2b5d52075 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AzureIntegrationUpdate object. */ +@JsonPropertyOrder({ + AzureIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + AzureIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AzureIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AzureCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AzureIntegrationType type; + + public AzureIntegrationUpdate() {} + + @JsonCreator + public AzureIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AzureIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AzureIntegrationUpdate credentials(AzureCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the AzureCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AzureCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(AzureCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public AzureIntegrationUpdate type(AzureIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AzureIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AzureIntegrationType getType() { + return type; + } + + public void setType(AzureIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AzureIntegrationUpdate + */ + @JsonAnySetter + public AzureIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AzureIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AzureIntegrationUpdate azureIntegrationUpdate = (AzureIntegrationUpdate) o; + return Objects.equals(this.credentials, azureIntegrationUpdate.credentials) + && Objects.equals(this.type, azureIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, azureIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AzureIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureTenant.java b/src/main/java/com/datadog/api/client/v2/model/AzureTenant.java new file mode 100644 index 00000000000..f2b6716d54a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureTenant.java @@ -0,0 +1,272 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AzureTenant object. */ +@JsonPropertyOrder({ + AzureTenant.JSON_PROPERTY_APP_CLIENT_ID, + AzureTenant.JSON_PROPERTY_CLIENT_SECRET, + AzureTenant.JSON_PROPERTY_CUSTOM_SCOPES, + AzureTenant.JSON_PROPERTY_TENANT_ID, + AzureTenant.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AzureTenant { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_APP_CLIENT_ID = "app_client_id"; + private String appClientId; + + public static final String JSON_PROPERTY_CLIENT_SECRET = "client_secret"; + private String clientSecret; + + public static final String JSON_PROPERTY_CUSTOM_SCOPES = "custom_scopes"; + private String customScopes; + + public static final String JSON_PROPERTY_TENANT_ID = "tenant_id"; + private String tenantId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AzureTenantType type; + + public AzureTenant() {} + + @JsonCreator + public AzureTenant( + @JsonProperty(required = true, value = JSON_PROPERTY_APP_CLIENT_ID) String appClientId, + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_SECRET) String clientSecret, + @JsonProperty(required = true, value = JSON_PROPERTY_TENANT_ID) String tenantId, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AzureTenantType type) { + this.appClientId = appClientId; + this.clientSecret = clientSecret; + this.tenantId = tenantId; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AzureTenant appClientId(String appClientId) { + this.appClientId = appClientId; + return this; + } + + /** + * The Client ID, also known as the Application ID in Azure, is a unique identifier for an + * application. It's used to identify the application during the authentication process. Your + * Application (client) ID is listed in the application's overview page. You can navigate to your + * application via the Azure Directory. + * + * @return appClientId + */ + @JsonProperty(JSON_PROPERTY_APP_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAppClientId() { + return appClientId; + } + + public void setAppClientId(String appClientId) { + this.appClientId = appClientId; + } + + public AzureTenant clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * The Client Secret is a confidential piece of information known only to the application and + * Azure AD. It's used to prove the application's identity. Your Client Secret is available from + * the application’s secrets page. You can navigate to your application via the Azure Directory. + * + * @return clientSecret + */ + @JsonProperty(JSON_PROPERTY_CLIENT_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public AzureTenant customScopes(String customScopes) { + this.customScopes = customScopes; + return this; + } + + /** + * If provided, the custom scope to be requested from Microsoft when acquiring an OAuth 2 access + * token. This custom scope is used only in conjunction with the HTTP action. A resource's scope + * is constructed by using the identifier URI for the resource and .default, separated by a + * forward slash (/) as follows:{identifierURI}/.default. + * + * @return customScopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomScopes() { + return customScopes; + } + + public void setCustomScopes(String customScopes) { + this.customScopes = customScopes; + } + + public AzureTenant tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * The Tenant ID, also known as the Directory ID in Azure, is a unique identifier that represents + * an Azure AD instance. Your Tenant ID (Directory ID) is listed in your Active Directory overview + * page under the 'Tenant information' section. + * + * @return tenantId + */ + @JsonProperty(JSON_PROPERTY_TENANT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public AzureTenant type(AzureTenantType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AzureTenant object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AzureTenantType getType() { + return type; + } + + public void setType(AzureTenantType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AzureTenant + */ + @JsonAnySetter + public AzureTenant putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AzureTenant object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AzureTenant azureTenant = (AzureTenant) o; + return Objects.equals(this.appClientId, azureTenant.appClientId) + && Objects.equals(this.clientSecret, azureTenant.clientSecret) + && Objects.equals(this.customScopes, azureTenant.customScopes) + && Objects.equals(this.tenantId, azureTenant.tenantId) + && Objects.equals(this.type, azureTenant.type) + && Objects.equals(this.additionalProperties, azureTenant.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + appClientId, clientSecret, customScopes, tenantId, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AzureTenant {\n"); + sb.append(" appClientId: ").append(toIndentedString(appClientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append(" customScopes: ").append(toIndentedString(customScopes)).append("\n"); + sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureTenantType.java b/src/main/java/com/datadog/api/client/v2/model/AzureTenantType.java new file mode 100644 index 00000000000..a4a2b5e633d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureTenantType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the AzureTenant object. */ +@JsonSerialize(using = AzureTenantType.AzureTenantTypeSerializer.class) +public class AzureTenantType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("AzureTenant")); + + public static final AzureTenantType AZURETENANT = new AzureTenantType("AzureTenant"); + + AzureTenantType(String value) { + super(value, allowedValues); + } + + public static class AzureTenantTypeSerializer extends StdSerializer { + public AzureTenantTypeSerializer(Class t) { + super(t); + } + + public AzureTenantTypeSerializer() { + this(null); + } + + @Override + public void serialize(AzureTenantType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AzureTenantType fromValue(String value) { + return new AzureTenantType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AzureTenantUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AzureTenantUpdate.java new file mode 100644 index 00000000000..fd52b00d42b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AzureTenantUpdate.java @@ -0,0 +1,269 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the AzureTenant object. */ +@JsonPropertyOrder({ + AzureTenantUpdate.JSON_PROPERTY_APP_CLIENT_ID, + AzureTenantUpdate.JSON_PROPERTY_CLIENT_SECRET, + AzureTenantUpdate.JSON_PROPERTY_CUSTOM_SCOPES, + AzureTenantUpdate.JSON_PROPERTY_TENANT_ID, + AzureTenantUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AzureTenantUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_APP_CLIENT_ID = "app_client_id"; + private String appClientId; + + public static final String JSON_PROPERTY_CLIENT_SECRET = "client_secret"; + private String clientSecret; + + public static final String JSON_PROPERTY_CUSTOM_SCOPES = "custom_scopes"; + private String customScopes; + + public static final String JSON_PROPERTY_TENANT_ID = "tenant_id"; + private String tenantId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AzureTenantType type; + + public AzureTenantUpdate() {} + + @JsonCreator + public AzureTenantUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AzureTenantType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AzureTenantUpdate appClientId(String appClientId) { + this.appClientId = appClientId; + return this; + } + + /** + * The Client ID, also known as the Application ID in Azure, is a unique identifier for an + * application. It's used to identify the application during the authentication process. Your + * Application (client) ID is listed in the application's overview page. You can navigate to your + * application via the Azure Directory. + * + * @return appClientId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_APP_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAppClientId() { + return appClientId; + } + + public void setAppClientId(String appClientId) { + this.appClientId = appClientId; + } + + public AzureTenantUpdate clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * The Client Secret is a confidential piece of information known only to the application and + * Azure AD. It's used to prove the application's identity. Your Client Secret is available from + * the application’s secrets page. You can navigate to your application via the Azure Directory. + * + * @return clientSecret + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public AzureTenantUpdate customScopes(String customScopes) { + this.customScopes = customScopes; + return this; + } + + /** + * If provided, the custom scope to be requested from Microsoft when acquiring an OAuth 2 access + * token. This custom scope is used only in conjunction with the HTTP action. A resource's scope + * is constructed by using the identifier URI for the resource and .default, separated by a + * forward slash (/) as follows:{identifierURI}/.default. + * + * @return customScopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomScopes() { + return customScopes; + } + + public void setCustomScopes(String customScopes) { + this.customScopes = customScopes; + } + + public AzureTenantUpdate tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * The Tenant ID, also known as the Directory ID in Azure, is a unique identifier that represents + * an Azure AD instance. Your Tenant ID (Directory ID) is listed in your Active Directory overview + * page under the 'Tenant information' section. + * + * @return tenantId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TENANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public AzureTenantUpdate type(AzureTenantType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the AzureTenant object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AzureTenantType getType() { + return type; + } + + public void setType(AzureTenantType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AzureTenantUpdate + */ + @JsonAnySetter + public AzureTenantUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AzureTenantUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AzureTenantUpdate azureTenantUpdate = (AzureTenantUpdate) o; + return Objects.equals(this.appClientId, azureTenantUpdate.appClientId) + && Objects.equals(this.clientSecret, azureTenantUpdate.clientSecret) + && Objects.equals(this.customScopes, azureTenantUpdate.customScopes) + && Objects.equals(this.tenantId, azureTenantUpdate.tenantId) + && Objects.equals(this.type, azureTenantUpdate.type) + && Objects.equals(this.additionalProperties, azureTenantUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + appClientId, clientSecret, customScopes, tenantId, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AzureTenantUpdate {\n"); + sb.append(" appClientId: ").append(toIndentedString(appClientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append(" customScopes: ").append(toIndentedString(customScopes)).append("\n"); + sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKey.java new file mode 100644 index 00000000000..95e15eb4bd3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CircleCIAPIKey object. */ +@JsonPropertyOrder({CircleCIAPIKey.JSON_PROPERTY_API_TOKEN, CircleCIAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CircleCIAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CircleCIAPIKeyType type; + + public CircleCIAPIKey() {} + + @JsonCreator + public CircleCIAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CircleCIAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CircleCIAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The CircleCIAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public CircleCIAPIKey type(CircleCIAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CircleCIAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CircleCIAPIKeyType getType() { + return type; + } + + public void setType(CircleCIAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CircleCIAPIKey + */ + @JsonAnySetter + public CircleCIAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CircleCIAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircleCIAPIKey circleCiapiKey = (CircleCIAPIKey) o; + return Objects.equals(this.apiToken, circleCiapiKey.apiToken) + && Objects.equals(this.type, circleCiapiKey.type) + && Objects.equals(this.additionalProperties, circleCiapiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircleCIAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKeyType.java new file mode 100644 index 00000000000..cdf2ce4c12a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the CircleCIAPIKey object. */ +@JsonSerialize(using = CircleCIAPIKeyType.CircleCIAPIKeyTypeSerializer.class) +public class CircleCIAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("CircleCIAPIKey")); + + public static final CircleCIAPIKeyType CIRCLECIAPIKEY = new CircleCIAPIKeyType("CircleCIAPIKey"); + + CircleCIAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class CircleCIAPIKeyTypeSerializer extends StdSerializer { + public CircleCIAPIKeyTypeSerializer(Class t) { + super(t); + } + + public CircleCIAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(CircleCIAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CircleCIAPIKeyType fromValue(String value) { + return new CircleCIAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKeyUpdate.java new file mode 100644 index 00000000000..29b28fcffb1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCIAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CircleCIAPIKey object. */ +@JsonPropertyOrder({ + CircleCIAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + CircleCIAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CircleCIAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CircleCIAPIKeyType type; + + public CircleCIAPIKeyUpdate() {} + + @JsonCreator + public CircleCIAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CircleCIAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CircleCIAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The CircleCIAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public CircleCIAPIKeyUpdate type(CircleCIAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CircleCIAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CircleCIAPIKeyType getType() { + return type; + } + + public void setType(CircleCIAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CircleCIAPIKeyUpdate + */ + @JsonAnySetter + public CircleCIAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CircleCIAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircleCIAPIKeyUpdate circleCiapiKeyUpdate = (CircleCIAPIKeyUpdate) o; + return Objects.equals(this.apiToken, circleCiapiKeyUpdate.apiToken) + && Objects.equals(this.type, circleCiapiKeyUpdate.type) + && Objects.equals(this.additionalProperties, circleCiapiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircleCIAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCICredentials.java b/src/main/java/com/datadog/api/client/v2/model/CircleCICredentials.java new file mode 100644 index 00000000000..0f4253285b3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCICredentials.java @@ -0,0 +1,210 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = CircleCICredentials.CircleCICredentialsDeserializer.class) +@JsonSerialize(using = CircleCICredentials.CircleCICredentialsSerializer.class) +public class CircleCICredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CircleCICredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class CircleCICredentialsSerializer extends StdSerializer { + public CircleCICredentialsSerializer(Class t) { + super(t); + } + + public CircleCICredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + CircleCICredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class CircleCICredentialsDeserializer extends StdDeserializer { + public CircleCICredentialsDeserializer() { + this(CircleCICredentials.class); + } + + public CircleCICredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public CircleCICredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize CircleCIAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CircleCIAPIKey.class.equals(Integer.class) + || CircleCIAPIKey.class.equals(Long.class) + || CircleCIAPIKey.class.equals(Float.class) + || CircleCIAPIKey.class.equals(Double.class) + || CircleCIAPIKey.class.equals(Boolean.class) + || CircleCIAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CircleCIAPIKey.class.equals(Integer.class) + || CircleCIAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CircleCIAPIKey.class.equals(Float.class) + || CircleCIAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CircleCIAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CircleCIAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CircleCIAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CircleCIAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CircleCIAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CircleCIAPIKey'", e); + } + + CircleCICredentials ret = new CircleCICredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public CircleCICredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CircleCICredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public CircleCICredentials() { + super("oneOf", Boolean.FALSE); + } + + public CircleCICredentials(CircleCIAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CircleCIAPIKey", new GenericType() {}); + JSON.registerDescendants(CircleCICredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return CircleCICredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CircleCIAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(CircleCIAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be CircleCIAPIKey"); + } + + /** + * Get the actual instance, which can be the following: CircleCIAPIKey + * + * @return The actual instance (CircleCIAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CircleCIAPIKey`. If the actual instance is not `CircleCIAPIKey`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CircleCIAPIKey` + * @throws ClassCastException if the instance is not `CircleCIAPIKey` + */ + public CircleCIAPIKey getCircleCIAPIKey() throws ClassCastException { + return (CircleCIAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCICredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CircleCICredentialsUpdate.java new file mode 100644 index 00000000000..b06891a87bb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCICredentialsUpdate.java @@ -0,0 +1,213 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = CircleCICredentialsUpdate.CircleCICredentialsUpdateDeserializer.class) +@JsonSerialize(using = CircleCICredentialsUpdate.CircleCICredentialsUpdateSerializer.class) +public class CircleCICredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CircleCICredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class CircleCICredentialsUpdateSerializer + extends StdSerializer { + public CircleCICredentialsUpdateSerializer(Class t) { + super(t); + } + + public CircleCICredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + CircleCICredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class CircleCICredentialsUpdateDeserializer + extends StdDeserializer { + public CircleCICredentialsUpdateDeserializer() { + this(CircleCICredentialsUpdate.class); + } + + public CircleCICredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public CircleCICredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize CircleCIAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CircleCIAPIKeyUpdate.class.equals(Integer.class) + || CircleCIAPIKeyUpdate.class.equals(Long.class) + || CircleCIAPIKeyUpdate.class.equals(Float.class) + || CircleCIAPIKeyUpdate.class.equals(Double.class) + || CircleCIAPIKeyUpdate.class.equals(Boolean.class) + || CircleCIAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CircleCIAPIKeyUpdate.class.equals(Integer.class) + || CircleCIAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CircleCIAPIKeyUpdate.class.equals(Float.class) + || CircleCIAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CircleCIAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CircleCIAPIKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CircleCIAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CircleCIAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CircleCIAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CircleCIAPIKeyUpdate'", e); + } + + CircleCICredentialsUpdate ret = new CircleCICredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public CircleCICredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CircleCICredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public CircleCICredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public CircleCICredentialsUpdate(CircleCIAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CircleCIAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(CircleCICredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return CircleCICredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CircleCIAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(CircleCIAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be CircleCIAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: CircleCIAPIKeyUpdate + * + * @return The actual instance (CircleCIAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CircleCIAPIKeyUpdate`. If the actual instance is not + * `CircleCIAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `CircleCIAPIKeyUpdate` + * @throws ClassCastException if the instance is not `CircleCIAPIKeyUpdate` + */ + public CircleCIAPIKeyUpdate getCircleCIAPIKeyUpdate() throws ClassCastException { + return (CircleCIAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegration.java b/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegration.java new file mode 100644 index 00000000000..36db5e4b25f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CircleCIIntegration object. */ +@JsonPropertyOrder({ + CircleCIIntegration.JSON_PROPERTY_CREDENTIALS, + CircleCIIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CircleCIIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private CircleCICredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CircleCIIntegrationType type; + + public CircleCIIntegration() {} + + @JsonCreator + public CircleCIIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + CircleCICredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CircleCIIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CircleCIIntegration credentials(CircleCICredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the CircleCICredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CircleCICredentials getCredentials() { + return credentials; + } + + public void setCredentials(CircleCICredentials credentials) { + this.credentials = credentials; + } + + public CircleCIIntegration type(CircleCIIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CircleCIIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CircleCIIntegrationType getType() { + return type; + } + + public void setType(CircleCIIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CircleCIIntegration + */ + @JsonAnySetter + public CircleCIIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CircleCIIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircleCIIntegration circleCiIntegration = (CircleCIIntegration) o; + return Objects.equals(this.credentials, circleCiIntegration.credentials) + && Objects.equals(this.type, circleCiIntegration.type) + && Objects.equals(this.additionalProperties, circleCiIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircleCIIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegrationType.java new file mode 100644 index 00000000000..908e3b73621 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegrationType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the CircleCIIntegrationType object. */ +@JsonSerialize(using = CircleCIIntegrationType.CircleCIIntegrationTypeSerializer.class) +public class CircleCIIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("CircleCI")); + + public static final CircleCIIntegrationType CIRCLECI = new CircleCIIntegrationType("CircleCI"); + + CircleCIIntegrationType(String value) { + super(value, allowedValues); + } + + public static class CircleCIIntegrationTypeSerializer + extends StdSerializer { + public CircleCIIntegrationTypeSerializer(Class t) { + super(t); + } + + public CircleCIIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CircleCIIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CircleCIIntegrationType fromValue(String value) { + return new CircleCIIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegrationUpdate.java new file mode 100644 index 00000000000..25f9702f519 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CircleCIIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CircleCIIntegrationUpdate object. */ +@JsonPropertyOrder({ + CircleCIIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + CircleCIIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CircleCIIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private CircleCICredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CircleCIIntegrationType type; + + public CircleCIIntegrationUpdate() {} + + @JsonCreator + public CircleCIIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CircleCIIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CircleCIIntegrationUpdate credentials(CircleCICredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the CircleCICredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CircleCICredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(CircleCICredentialsUpdate credentials) { + this.credentials = credentials; + } + + public CircleCIIntegrationUpdate type(CircleCIIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CircleCIIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CircleCIIntegrationType getType() { + return type; + } + + public void setType(CircleCIIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CircleCIIntegrationUpdate + */ + @JsonAnySetter + public CircleCIIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CircleCIIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircleCIIntegrationUpdate circleCiIntegrationUpdate = (CircleCIIntegrationUpdate) o; + return Objects.equals(this.credentials, circleCiIntegrationUpdate.credentials) + && Objects.equals(this.type, circleCiIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, circleCiIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircleCIIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKey.java new file mode 100644 index 00000000000..495c68dbb48 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ClickupAPIKey object. */ +@JsonPropertyOrder({ClickupAPIKey.JSON_PROPERTY_API_TOKEN, ClickupAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ClickupAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ClickupAPIKeyType type; + + public ClickupAPIKey() {} + + @JsonCreator + public ClickupAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ClickupAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ClickupAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The ClickupAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public ClickupAPIKey type(ClickupAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ClickupAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ClickupAPIKeyType getType() { + return type; + } + + public void setType(ClickupAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ClickupAPIKey + */ + @JsonAnySetter + public ClickupAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ClickupAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClickupAPIKey clickupApiKey = (ClickupAPIKey) o; + return Objects.equals(this.apiToken, clickupApiKey.apiToken) + && Objects.equals(this.type, clickupApiKey.type) + && Objects.equals(this.additionalProperties, clickupApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClickupAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKeyType.java new file mode 100644 index 00000000000..99ba7275973 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the ClickupAPIKey object. */ +@JsonSerialize(using = ClickupAPIKeyType.ClickupAPIKeyTypeSerializer.class) +public class ClickupAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ClickupAPIKey")); + + public static final ClickupAPIKeyType CLICKUPAPIKEY = new ClickupAPIKeyType("ClickupAPIKey"); + + ClickupAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class ClickupAPIKeyTypeSerializer extends StdSerializer { + public ClickupAPIKeyTypeSerializer(Class t) { + super(t); + } + + public ClickupAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(ClickupAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ClickupAPIKeyType fromValue(String value) { + return new ClickupAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKeyUpdate.java new file mode 100644 index 00000000000..dc886471ea3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ClickupAPIKey object. */ +@JsonPropertyOrder({ + ClickupAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + ClickupAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ClickupAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ClickupAPIKeyType type; + + public ClickupAPIKeyUpdate() {} + + @JsonCreator + public ClickupAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ClickupAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ClickupAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The ClickupAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public ClickupAPIKeyUpdate type(ClickupAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ClickupAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ClickupAPIKeyType getType() { + return type; + } + + public void setType(ClickupAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ClickupAPIKeyUpdate + */ + @JsonAnySetter + public ClickupAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ClickupAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClickupAPIKeyUpdate clickupApiKeyUpdate = (ClickupAPIKeyUpdate) o; + return Objects.equals(this.apiToken, clickupApiKeyUpdate.apiToken) + && Objects.equals(this.type, clickupApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, clickupApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClickupAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupCredentials.java b/src/main/java/com/datadog/api/client/v2/model/ClickupCredentials.java new file mode 100644 index 00000000000..7b3bc64d1cd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupCredentials.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ClickupCredentials.ClickupCredentialsDeserializer.class) +@JsonSerialize(using = ClickupCredentials.ClickupCredentialsSerializer.class) +public class ClickupCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ClickupCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ClickupCredentialsSerializer extends StdSerializer { + public ClickupCredentialsSerializer(Class t) { + super(t); + } + + public ClickupCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(ClickupCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ClickupCredentialsDeserializer extends StdDeserializer { + public ClickupCredentialsDeserializer() { + this(ClickupCredentials.class); + } + + public ClickupCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public ClickupCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ClickupAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ClickupAPIKey.class.equals(Integer.class) + || ClickupAPIKey.class.equals(Long.class) + || ClickupAPIKey.class.equals(Float.class) + || ClickupAPIKey.class.equals(Double.class) + || ClickupAPIKey.class.equals(Boolean.class) + || ClickupAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ClickupAPIKey.class.equals(Integer.class) + || ClickupAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ClickupAPIKey.class.equals(Float.class) + || ClickupAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ClickupAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ClickupAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ClickupAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ClickupAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ClickupAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ClickupAPIKey'", e); + } + + ClickupCredentials ret = new ClickupCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ClickupCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ClickupCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ClickupCredentials() { + super("oneOf", Boolean.FALSE); + } + + public ClickupCredentials(ClickupAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ClickupAPIKey", new GenericType() {}); + JSON.registerDescendants(ClickupCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ClickupCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ClickupAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ClickupAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ClickupAPIKey"); + } + + /** + * Get the actual instance, which can be the following: ClickupAPIKey + * + * @return The actual instance (ClickupAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ClickupAPIKey`. If the actual instance is not `ClickupAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `ClickupAPIKey` + * @throws ClassCastException if the instance is not `ClickupAPIKey` + */ + public ClickupAPIKey getClickupAPIKey() throws ClassCastException { + return (ClickupAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ClickupCredentialsUpdate.java new file mode 100644 index 00000000000..3da89b94940 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ClickupCredentialsUpdate.ClickupCredentialsUpdateDeserializer.class) +@JsonSerialize(using = ClickupCredentialsUpdate.ClickupCredentialsUpdateSerializer.class) +public class ClickupCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ClickupCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ClickupCredentialsUpdateSerializer + extends StdSerializer { + public ClickupCredentialsUpdateSerializer(Class t) { + super(t); + } + + public ClickupCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + ClickupCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ClickupCredentialsUpdateDeserializer + extends StdDeserializer { + public ClickupCredentialsUpdateDeserializer() { + this(ClickupCredentialsUpdate.class); + } + + public ClickupCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public ClickupCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ClickupAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ClickupAPIKeyUpdate.class.equals(Integer.class) + || ClickupAPIKeyUpdate.class.equals(Long.class) + || ClickupAPIKeyUpdate.class.equals(Float.class) + || ClickupAPIKeyUpdate.class.equals(Double.class) + || ClickupAPIKeyUpdate.class.equals(Boolean.class) + || ClickupAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ClickupAPIKeyUpdate.class.equals(Integer.class) + || ClickupAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ClickupAPIKeyUpdate.class.equals(Float.class) + || ClickupAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ClickupAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ClickupAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ClickupAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ClickupAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ClickupAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ClickupAPIKeyUpdate'", e); + } + + ClickupCredentialsUpdate ret = new ClickupCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ClickupCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ClickupCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ClickupCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public ClickupCredentialsUpdate(ClickupAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ClickupAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(ClickupCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ClickupCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ClickupAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ClickupAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ClickupAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: ClickupAPIKeyUpdate + * + * @return The actual instance (ClickupAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ClickupAPIKeyUpdate`. If the actual instance is not + * `ClickupAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `ClickupAPIKeyUpdate` + * @throws ClassCastException if the instance is not `ClickupAPIKeyUpdate` + */ + public ClickupAPIKeyUpdate getClickupAPIKeyUpdate() throws ClassCastException { + return (ClickupAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupIntegration.java b/src/main/java/com/datadog/api/client/v2/model/ClickupIntegration.java new file mode 100644 index 00000000000..5ef6190ff75 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ClickupIntegration object. */ +@JsonPropertyOrder({ + ClickupIntegration.JSON_PROPERTY_CREDENTIALS, + ClickupIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ClickupIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private ClickupCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ClickupIntegrationType type; + + public ClickupIntegration() {} + + @JsonCreator + public ClickupIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + ClickupCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ClickupIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ClickupIntegration credentials(ClickupCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the ClickupCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ClickupCredentials getCredentials() { + return credentials; + } + + public void setCredentials(ClickupCredentials credentials) { + this.credentials = credentials; + } + + public ClickupIntegration type(ClickupIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ClickupIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ClickupIntegrationType getType() { + return type; + } + + public void setType(ClickupIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ClickupIntegration + */ + @JsonAnySetter + public ClickupIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ClickupIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClickupIntegration clickupIntegration = (ClickupIntegration) o; + return Objects.equals(this.credentials, clickupIntegration.credentials) + && Objects.equals(this.type, clickupIntegration.type) + && Objects.equals(this.additionalProperties, clickupIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClickupIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/ClickupIntegrationType.java new file mode 100644 index 00000000000..e7aa1fe4f49 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupIntegrationType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the ClickupIntegrationType object. */ +@JsonSerialize(using = ClickupIntegrationType.ClickupIntegrationTypeSerializer.class) +public class ClickupIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Clickup")); + + public static final ClickupIntegrationType CLICKUP = new ClickupIntegrationType("Clickup"); + + ClickupIntegrationType(String value) { + super(value, allowedValues); + } + + public static class ClickupIntegrationTypeSerializer + extends StdSerializer { + public ClickupIntegrationTypeSerializer(Class t) { + super(t); + } + + public ClickupIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ClickupIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ClickupIntegrationType fromValue(String value) { + return new ClickupIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ClickupIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ClickupIntegrationUpdate.java new file mode 100644 index 00000000000..20bb387e3d9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ClickupIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ClickupIntegrationUpdate object. */ +@JsonPropertyOrder({ + ClickupIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + ClickupIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ClickupIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private ClickupCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ClickupIntegrationType type; + + public ClickupIntegrationUpdate() {} + + @JsonCreator + public ClickupIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ClickupIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ClickupIntegrationUpdate credentials(ClickupCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the ClickupCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ClickupCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(ClickupCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public ClickupIntegrationUpdate type(ClickupIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ClickupIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ClickupIntegrationType getType() { + return type; + } + + public void setType(ClickupIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ClickupIntegrationUpdate + */ + @JsonAnySetter + public ClickupIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ClickupIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClickupIntegrationUpdate clickupIntegrationUpdate = (ClickupIntegrationUpdate) o; + return Objects.equals(this.credentials, clickupIntegrationUpdate.credentials) + && Objects.equals(this.type, clickupIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, clickupIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClickupIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareAPIToken.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareAPIToken.java new file mode 100644 index 00000000000..7a44638bf83 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareAPIToken.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CloudflareAPIToken object. */ +@JsonPropertyOrder({ + CloudflareAPIToken.JSON_PROPERTY_API_TOKEN, + CloudflareAPIToken.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CloudflareAPIToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CloudflareAPITokenType type; + + public CloudflareAPIToken() {} + + @JsonCreator + public CloudflareAPIToken( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CloudflareAPITokenType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CloudflareAPIToken apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The CloudflareAPIToken api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public CloudflareAPIToken type(CloudflareAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CloudflareAPIToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareAPITokenType getType() { + return type; + } + + public void setType(CloudflareAPITokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CloudflareAPIToken + */ + @JsonAnySetter + public CloudflareAPIToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CloudflareAPIToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloudflareAPIToken cloudflareApiToken = (CloudflareAPIToken) o; + return Objects.equals(this.apiToken, cloudflareApiToken.apiToken) + && Objects.equals(this.type, cloudflareApiToken.type) + && Objects.equals(this.additionalProperties, cloudflareApiToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloudflareAPIToken {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareAPITokenType.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareAPITokenType.java new file mode 100644 index 00000000000..d83883b2924 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareAPITokenType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the CloudflareAPIToken object. */ +@JsonSerialize(using = CloudflareAPITokenType.CloudflareAPITokenTypeSerializer.class) +public class CloudflareAPITokenType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("CloudflareAPIToken")); + + public static final CloudflareAPITokenType CLOUDFLAREAPITOKEN = + new CloudflareAPITokenType("CloudflareAPIToken"); + + CloudflareAPITokenType(String value) { + super(value, allowedValues); + } + + public static class CloudflareAPITokenTypeSerializer + extends StdSerializer { + public CloudflareAPITokenTypeSerializer(Class t) { + super(t); + } + + public CloudflareAPITokenTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CloudflareAPITokenType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CloudflareAPITokenType fromValue(String value) { + return new CloudflareAPITokenType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareAPITokenUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareAPITokenUpdate.java new file mode 100644 index 00000000000..8ec2d25498d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareAPITokenUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CloudflareAPIToken object. */ +@JsonPropertyOrder({ + CloudflareAPITokenUpdate.JSON_PROPERTY_API_TOKEN, + CloudflareAPITokenUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CloudflareAPITokenUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CloudflareAPITokenType type; + + public CloudflareAPITokenUpdate() {} + + @JsonCreator + public CloudflareAPITokenUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CloudflareAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CloudflareAPITokenUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The CloudflareAPITokenUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public CloudflareAPITokenUpdate type(CloudflareAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CloudflareAPIToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareAPITokenType getType() { + return type; + } + + public void setType(CloudflareAPITokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CloudflareAPITokenUpdate + */ + @JsonAnySetter + public CloudflareAPITokenUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CloudflareAPITokenUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloudflareAPITokenUpdate cloudflareApiTokenUpdate = (CloudflareAPITokenUpdate) o; + return Objects.equals(this.apiToken, cloudflareApiTokenUpdate.apiToken) + && Objects.equals(this.type, cloudflareApiTokenUpdate.type) + && Objects.equals(this.additionalProperties, cloudflareApiTokenUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloudflareAPITokenUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareCredentials.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareCredentials.java new file mode 100644 index 00000000000..3576b478062 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareCredentials.java @@ -0,0 +1,279 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = CloudflareCredentials.CloudflareCredentialsDeserializer.class) +@JsonSerialize(using = CloudflareCredentials.CloudflareCredentialsSerializer.class) +public class CloudflareCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CloudflareCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class CloudflareCredentialsSerializer extends StdSerializer { + public CloudflareCredentialsSerializer(Class t) { + super(t); + } + + public CloudflareCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + CloudflareCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class CloudflareCredentialsDeserializer + extends StdDeserializer { + public CloudflareCredentialsDeserializer() { + this(CloudflareCredentials.class); + } + + public CloudflareCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public CloudflareCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize CloudflareAPIToken + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CloudflareAPIToken.class.equals(Integer.class) + || CloudflareAPIToken.class.equals(Long.class) + || CloudflareAPIToken.class.equals(Float.class) + || CloudflareAPIToken.class.equals(Double.class) + || CloudflareAPIToken.class.equals(Boolean.class) + || CloudflareAPIToken.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CloudflareAPIToken.class.equals(Integer.class) + || CloudflareAPIToken.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CloudflareAPIToken.class.equals(Float.class) + || CloudflareAPIToken.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CloudflareAPIToken.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CloudflareAPIToken.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CloudflareAPIToken.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CloudflareAPIToken) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CloudflareAPIToken'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CloudflareAPIToken'", e); + } + + // deserialize CloudflareGlobalAPIToken + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CloudflareGlobalAPIToken.class.equals(Integer.class) + || CloudflareGlobalAPIToken.class.equals(Long.class) + || CloudflareGlobalAPIToken.class.equals(Float.class) + || CloudflareGlobalAPIToken.class.equals(Double.class) + || CloudflareGlobalAPIToken.class.equals(Boolean.class) + || CloudflareGlobalAPIToken.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CloudflareGlobalAPIToken.class.equals(Integer.class) + || CloudflareGlobalAPIToken.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CloudflareGlobalAPIToken.class.equals(Float.class) + || CloudflareGlobalAPIToken.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CloudflareGlobalAPIToken.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CloudflareGlobalAPIToken.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CloudflareGlobalAPIToken.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CloudflareGlobalAPIToken) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CloudflareGlobalAPIToken'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CloudflareGlobalAPIToken'", e); + } + + CloudflareCredentials ret = new CloudflareCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public CloudflareCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CloudflareCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public CloudflareCredentials() { + super("oneOf", Boolean.FALSE); + } + + public CloudflareCredentials(CloudflareAPIToken o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CloudflareCredentials(CloudflareGlobalAPIToken o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CloudflareAPIToken", new GenericType() {}); + schemas.put("CloudflareGlobalAPIToken", new GenericType() {}); + JSON.registerDescendants(CloudflareCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return CloudflareCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CloudflareAPIToken, CloudflareGlobalAPIToken + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(CloudflareAPIToken.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(CloudflareGlobalAPIToken.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be CloudflareAPIToken, CloudflareGlobalAPIToken"); + } + + /** + * Get the actual instance, which can be the following: CloudflareAPIToken, + * CloudflareGlobalAPIToken + * + * @return The actual instance (CloudflareAPIToken, CloudflareGlobalAPIToken) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CloudflareAPIToken`. If the actual instance is not + * `CloudflareAPIToken`, the ClassCastException will be thrown. + * + * @return The actual instance of `CloudflareAPIToken` + * @throws ClassCastException if the instance is not `CloudflareAPIToken` + */ + public CloudflareAPIToken getCloudflareAPIToken() throws ClassCastException { + return (CloudflareAPIToken) super.getActualInstance(); + } + + /** + * Get the actual instance of `CloudflareGlobalAPIToken`. If the actual instance is not + * `CloudflareGlobalAPIToken`, the ClassCastException will be thrown. + * + * @return The actual instance of `CloudflareGlobalAPIToken` + * @throws ClassCastException if the instance is not `CloudflareGlobalAPIToken` + */ + public CloudflareGlobalAPIToken getCloudflareGlobalAPIToken() throws ClassCastException { + return (CloudflareGlobalAPIToken) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareCredentialsUpdate.java new file mode 100644 index 00000000000..d79d892ce99 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareCredentialsUpdate.java @@ -0,0 +1,287 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = CloudflareCredentialsUpdate.CloudflareCredentialsUpdateDeserializer.class) +@JsonSerialize(using = CloudflareCredentialsUpdate.CloudflareCredentialsUpdateSerializer.class) +public class CloudflareCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CloudflareCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class CloudflareCredentialsUpdateSerializer + extends StdSerializer { + public CloudflareCredentialsUpdateSerializer(Class t) { + super(t); + } + + public CloudflareCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + CloudflareCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class CloudflareCredentialsUpdateDeserializer + extends StdDeserializer { + public CloudflareCredentialsUpdateDeserializer() { + this(CloudflareCredentialsUpdate.class); + } + + public CloudflareCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public CloudflareCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize CloudflareAPITokenUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CloudflareAPITokenUpdate.class.equals(Integer.class) + || CloudflareAPITokenUpdate.class.equals(Long.class) + || CloudflareAPITokenUpdate.class.equals(Float.class) + || CloudflareAPITokenUpdate.class.equals(Double.class) + || CloudflareAPITokenUpdate.class.equals(Boolean.class) + || CloudflareAPITokenUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CloudflareAPITokenUpdate.class.equals(Integer.class) + || CloudflareAPITokenUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CloudflareAPITokenUpdate.class.equals(Float.class) + || CloudflareAPITokenUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CloudflareAPITokenUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CloudflareAPITokenUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CloudflareAPITokenUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CloudflareAPITokenUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CloudflareAPITokenUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CloudflareAPITokenUpdate'", e); + } + + // deserialize CloudflareGlobalAPITokenUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CloudflareGlobalAPITokenUpdate.class.equals(Integer.class) + || CloudflareGlobalAPITokenUpdate.class.equals(Long.class) + || CloudflareGlobalAPITokenUpdate.class.equals(Float.class) + || CloudflareGlobalAPITokenUpdate.class.equals(Double.class) + || CloudflareGlobalAPITokenUpdate.class.equals(Boolean.class) + || CloudflareGlobalAPITokenUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CloudflareGlobalAPITokenUpdate.class.equals(Integer.class) + || CloudflareGlobalAPITokenUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CloudflareGlobalAPITokenUpdate.class.equals(Float.class) + || CloudflareGlobalAPITokenUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CloudflareGlobalAPITokenUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CloudflareGlobalAPITokenUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CloudflareGlobalAPITokenUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CloudflareGlobalAPITokenUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CloudflareGlobalAPITokenUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'CloudflareGlobalAPITokenUpdate'", e); + } + + CloudflareCredentialsUpdate ret = new CloudflareCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public CloudflareCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "CloudflareCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public CloudflareCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public CloudflareCredentialsUpdate(CloudflareAPITokenUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CloudflareCredentialsUpdate(CloudflareGlobalAPITokenUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CloudflareAPITokenUpdate", new GenericType() {}); + schemas.put( + "CloudflareGlobalAPITokenUpdate", new GenericType() {}); + JSON.registerDescendants( + CloudflareCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return CloudflareCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CloudflareAPITokenUpdate, CloudflareGlobalAPITokenUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(CloudflareAPITokenUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + CloudflareGlobalAPITokenUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be CloudflareAPITokenUpdate, CloudflareGlobalAPITokenUpdate"); + } + + /** + * Get the actual instance, which can be the following: CloudflareAPITokenUpdate, + * CloudflareGlobalAPITokenUpdate + * + * @return The actual instance (CloudflareAPITokenUpdate, CloudflareGlobalAPITokenUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CloudflareAPITokenUpdate`. If the actual instance is not + * `CloudflareAPITokenUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `CloudflareAPITokenUpdate` + * @throws ClassCastException if the instance is not `CloudflareAPITokenUpdate` + */ + public CloudflareAPITokenUpdate getCloudflareAPITokenUpdate() throws ClassCastException { + return (CloudflareAPITokenUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `CloudflareGlobalAPITokenUpdate`. If the actual instance is not + * `CloudflareGlobalAPITokenUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `CloudflareGlobalAPITokenUpdate` + * @throws ClassCastException if the instance is not `CloudflareGlobalAPITokenUpdate` + */ + public CloudflareGlobalAPITokenUpdate getCloudflareGlobalAPITokenUpdate() + throws ClassCastException { + return (CloudflareGlobalAPITokenUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPIToken.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPIToken.java new file mode 100644 index 00000000000..a1736b4042c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPIToken.java @@ -0,0 +1,207 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CloudflareGlobalAPIToken object. */ +@JsonPropertyOrder({ + CloudflareGlobalAPIToken.JSON_PROPERTY_AUTH_EMAIL, + CloudflareGlobalAPIToken.JSON_PROPERTY_GLOBAL_API_KEY, + CloudflareGlobalAPIToken.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CloudflareGlobalAPIToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_EMAIL = "auth_email"; + private String authEmail; + + public static final String JSON_PROPERTY_GLOBAL_API_KEY = "global_api_key"; + private String globalApiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CloudflareGlobalAPITokenType type; + + public CloudflareGlobalAPIToken() {} + + @JsonCreator + public CloudflareGlobalAPIToken( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_EMAIL) String authEmail, + @JsonProperty(required = true, value = JSON_PROPERTY_GLOBAL_API_KEY) String globalApiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CloudflareGlobalAPITokenType type) { + this.authEmail = authEmail; + this.globalApiKey = globalApiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CloudflareGlobalAPIToken authEmail(String authEmail) { + this.authEmail = authEmail; + return this; + } + + /** + * The CloudflareGlobalAPIToken auth_email. + * + * @return authEmail + */ + @JsonProperty(JSON_PROPERTY_AUTH_EMAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAuthEmail() { + return authEmail; + } + + public void setAuthEmail(String authEmail) { + this.authEmail = authEmail; + } + + public CloudflareGlobalAPIToken globalApiKey(String globalApiKey) { + this.globalApiKey = globalApiKey; + return this; + } + + /** + * The CloudflareGlobalAPIToken global_api_key. + * + * @return globalApiKey + */ + @JsonProperty(JSON_PROPERTY_GLOBAL_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getGlobalApiKey() { + return globalApiKey; + } + + public void setGlobalApiKey(String globalApiKey) { + this.globalApiKey = globalApiKey; + } + + public CloudflareGlobalAPIToken type(CloudflareGlobalAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CloudflareGlobalAPIToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareGlobalAPITokenType getType() { + return type; + } + + public void setType(CloudflareGlobalAPITokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CloudflareGlobalAPIToken + */ + @JsonAnySetter + public CloudflareGlobalAPIToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CloudflareGlobalAPIToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloudflareGlobalAPIToken cloudflareGlobalApiToken = (CloudflareGlobalAPIToken) o; + return Objects.equals(this.authEmail, cloudflareGlobalApiToken.authEmail) + && Objects.equals(this.globalApiKey, cloudflareGlobalApiToken.globalApiKey) + && Objects.equals(this.type, cloudflareGlobalApiToken.type) + && Objects.equals(this.additionalProperties, cloudflareGlobalApiToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authEmail, globalApiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloudflareGlobalAPIToken {\n"); + sb.append(" authEmail: ").append(toIndentedString(authEmail)).append("\n"); + sb.append(" globalApiKey: ").append(toIndentedString(globalApiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPITokenType.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPITokenType.java new file mode 100644 index 00000000000..fe105ac0a63 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPITokenType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the CloudflareGlobalAPIToken object. */ +@JsonSerialize(using = CloudflareGlobalAPITokenType.CloudflareGlobalAPITokenTypeSerializer.class) +public class CloudflareGlobalAPITokenType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("CloudflareGlobalAPIToken")); + + public static final CloudflareGlobalAPITokenType CLOUDFLAREGLOBALAPITOKEN = + new CloudflareGlobalAPITokenType("CloudflareGlobalAPIToken"); + + CloudflareGlobalAPITokenType(String value) { + super(value, allowedValues); + } + + public static class CloudflareGlobalAPITokenTypeSerializer + extends StdSerializer { + public CloudflareGlobalAPITokenTypeSerializer(Class t) { + super(t); + } + + public CloudflareGlobalAPITokenTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CloudflareGlobalAPITokenType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CloudflareGlobalAPITokenType fromValue(String value) { + return new CloudflareGlobalAPITokenType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPITokenUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPITokenUpdate.java new file mode 100644 index 00000000000..41cab6763ab --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareGlobalAPITokenUpdate.java @@ -0,0 +1,207 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CloudflareGlobalAPIToken object. */ +@JsonPropertyOrder({ + CloudflareGlobalAPITokenUpdate.JSON_PROPERTY_AUTH_EMAIL, + CloudflareGlobalAPITokenUpdate.JSON_PROPERTY_GLOBAL_API_KEY, + CloudflareGlobalAPITokenUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CloudflareGlobalAPITokenUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_EMAIL = "auth_email"; + private String authEmail; + + public static final String JSON_PROPERTY_GLOBAL_API_KEY = "global_api_key"; + private String globalApiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CloudflareGlobalAPITokenType type; + + public CloudflareGlobalAPITokenUpdate() {} + + @JsonCreator + public CloudflareGlobalAPITokenUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CloudflareGlobalAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CloudflareGlobalAPITokenUpdate authEmail(String authEmail) { + this.authEmail = authEmail; + return this; + } + + /** + * The CloudflareGlobalAPITokenUpdate auth_email. + * + * @return authEmail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTH_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthEmail() { + return authEmail; + } + + public void setAuthEmail(String authEmail) { + this.authEmail = authEmail; + } + + public CloudflareGlobalAPITokenUpdate globalApiKey(String globalApiKey) { + this.globalApiKey = globalApiKey; + return this; + } + + /** + * The CloudflareGlobalAPITokenUpdate global_api_key. + * + * @return globalApiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GLOBAL_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getGlobalApiKey() { + return globalApiKey; + } + + public void setGlobalApiKey(String globalApiKey) { + this.globalApiKey = globalApiKey; + } + + public CloudflareGlobalAPITokenUpdate type(CloudflareGlobalAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CloudflareGlobalAPIToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareGlobalAPITokenType getType() { + return type; + } + + public void setType(CloudflareGlobalAPITokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CloudflareGlobalAPITokenUpdate + */ + @JsonAnySetter + public CloudflareGlobalAPITokenUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CloudflareGlobalAPITokenUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloudflareGlobalAPITokenUpdate cloudflareGlobalApiTokenUpdate = + (CloudflareGlobalAPITokenUpdate) o; + return Objects.equals(this.authEmail, cloudflareGlobalApiTokenUpdate.authEmail) + && Objects.equals(this.globalApiKey, cloudflareGlobalApiTokenUpdate.globalApiKey) + && Objects.equals(this.type, cloudflareGlobalApiTokenUpdate.type) + && Objects.equals( + this.additionalProperties, cloudflareGlobalApiTokenUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authEmail, globalApiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloudflareGlobalAPITokenUpdate {\n"); + sb.append(" authEmail: ").append(toIndentedString(authEmail)).append("\n"); + sb.append(" globalApiKey: ").append(toIndentedString(globalApiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegration.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegration.java new file mode 100644 index 00000000000..e4c7982cec6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CloudflareIntegration object. */ +@JsonPropertyOrder({ + CloudflareIntegration.JSON_PROPERTY_CREDENTIALS, + CloudflareIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CloudflareIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private CloudflareCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CloudflareIntegrationType type; + + public CloudflareIntegration() {} + + @JsonCreator + public CloudflareIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + CloudflareCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CloudflareIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CloudflareIntegration credentials(CloudflareCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the CloudflareCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareCredentials getCredentials() { + return credentials; + } + + public void setCredentials(CloudflareCredentials credentials) { + this.credentials = credentials; + } + + public CloudflareIntegration type(CloudflareIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CloudflareIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareIntegrationType getType() { + return type; + } + + public void setType(CloudflareIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CloudflareIntegration + */ + @JsonAnySetter + public CloudflareIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CloudflareIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloudflareIntegration cloudflareIntegration = (CloudflareIntegration) o; + return Objects.equals(this.credentials, cloudflareIntegration.credentials) + && Objects.equals(this.type, cloudflareIntegration.type) + && Objects.equals(this.additionalProperties, cloudflareIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloudflareIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegrationType.java new file mode 100644 index 00000000000..0eba7060bd5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegrationType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the CloudflareIntegrationType object. */ +@JsonSerialize(using = CloudflareIntegrationType.CloudflareIntegrationTypeSerializer.class) +public class CloudflareIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Cloudflare")); + + public static final CloudflareIntegrationType CLOUDFLARE = + new CloudflareIntegrationType("Cloudflare"); + + CloudflareIntegrationType(String value) { + super(value, allowedValues); + } + + public static class CloudflareIntegrationTypeSerializer + extends StdSerializer { + public CloudflareIntegrationTypeSerializer(Class t) { + super(t); + } + + public CloudflareIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CloudflareIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CloudflareIntegrationType fromValue(String value) { + return new CloudflareIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegrationUpdate.java new file mode 100644 index 00000000000..8d7eb85194a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CloudflareIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the CloudflareIntegrationUpdate object. */ +@JsonPropertyOrder({ + CloudflareIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + CloudflareIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CloudflareIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private CloudflareCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CloudflareIntegrationType type; + + public CloudflareIntegrationUpdate() {} + + @JsonCreator + public CloudflareIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CloudflareIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CloudflareIntegrationUpdate credentials(CloudflareCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the CloudflareCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CloudflareCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(CloudflareCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public CloudflareIntegrationUpdate type(CloudflareIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the CloudflareIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CloudflareIntegrationType getType() { + return type; + } + + public void setType(CloudflareIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CloudflareIntegrationUpdate + */ + @JsonAnySetter + public CloudflareIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CloudflareIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloudflareIntegrationUpdate cloudflareIntegrationUpdate = (CloudflareIntegrationUpdate) o; + return Objects.equals(this.credentials, cloudflareIntegrationUpdate.credentials) + && Objects.equals(this.type, cloudflareIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, cloudflareIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloudflareIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatCredentials.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatCredentials.java new file mode 100644 index 00000000000..dbafbb5255d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatCredentials.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ConfigCatCredentials.ConfigCatCredentialsDeserializer.class) +@JsonSerialize(using = ConfigCatCredentials.ConfigCatCredentialsSerializer.class) +public class ConfigCatCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ConfigCatCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ConfigCatCredentialsSerializer extends StdSerializer { + public ConfigCatCredentialsSerializer(Class t) { + super(t); + } + + public ConfigCatCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + ConfigCatCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ConfigCatCredentialsDeserializer + extends StdDeserializer { + public ConfigCatCredentialsDeserializer() { + this(ConfigCatCredentials.class); + } + + public ConfigCatCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public ConfigCatCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ConfigCatSDKKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ConfigCatSDKKey.class.equals(Integer.class) + || ConfigCatSDKKey.class.equals(Long.class) + || ConfigCatSDKKey.class.equals(Float.class) + || ConfigCatSDKKey.class.equals(Double.class) + || ConfigCatSDKKey.class.equals(Boolean.class) + || ConfigCatSDKKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ConfigCatSDKKey.class.equals(Integer.class) + || ConfigCatSDKKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ConfigCatSDKKey.class.equals(Float.class) + || ConfigCatSDKKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ConfigCatSDKKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ConfigCatSDKKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ConfigCatSDKKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ConfigCatSDKKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ConfigCatSDKKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ConfigCatSDKKey'", e); + } + + ConfigCatCredentials ret = new ConfigCatCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ConfigCatCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ConfigCatCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ConfigCatCredentials() { + super("oneOf", Boolean.FALSE); + } + + public ConfigCatCredentials(ConfigCatSDKKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ConfigCatSDKKey", new GenericType() {}); + JSON.registerDescendants(ConfigCatCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ConfigCatCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ConfigCatSDKKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ConfigCatSDKKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ConfigCatSDKKey"); + } + + /** + * Get the actual instance, which can be the following: ConfigCatSDKKey + * + * @return The actual instance (ConfigCatSDKKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ConfigCatSDKKey`. If the actual instance is not `ConfigCatSDKKey`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ConfigCatSDKKey` + * @throws ClassCastException if the instance is not `ConfigCatSDKKey` + */ + public ConfigCatSDKKey getConfigCatSDKKey() throws ClassCastException { + return (ConfigCatSDKKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatCredentialsUpdate.java new file mode 100644 index 00000000000..39bd5b84bbe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatCredentialsUpdate.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ConfigCatCredentialsUpdate.ConfigCatCredentialsUpdateDeserializer.class) +@JsonSerialize(using = ConfigCatCredentialsUpdate.ConfigCatCredentialsUpdateSerializer.class) +public class ConfigCatCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ConfigCatCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ConfigCatCredentialsUpdateSerializer + extends StdSerializer { + public ConfigCatCredentialsUpdateSerializer(Class t) { + super(t); + } + + public ConfigCatCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + ConfigCatCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ConfigCatCredentialsUpdateDeserializer + extends StdDeserializer { + public ConfigCatCredentialsUpdateDeserializer() { + this(ConfigCatCredentialsUpdate.class); + } + + public ConfigCatCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public ConfigCatCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ConfigCatSDKKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ConfigCatSDKKeyUpdate.class.equals(Integer.class) + || ConfigCatSDKKeyUpdate.class.equals(Long.class) + || ConfigCatSDKKeyUpdate.class.equals(Float.class) + || ConfigCatSDKKeyUpdate.class.equals(Double.class) + || ConfigCatSDKKeyUpdate.class.equals(Boolean.class) + || ConfigCatSDKKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ConfigCatSDKKeyUpdate.class.equals(Integer.class) + || ConfigCatSDKKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ConfigCatSDKKeyUpdate.class.equals(Float.class) + || ConfigCatSDKKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ConfigCatSDKKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ConfigCatSDKKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ConfigCatSDKKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ConfigCatSDKKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ConfigCatSDKKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ConfigCatSDKKeyUpdate'", e); + } + + ConfigCatCredentialsUpdate ret = new ConfigCatCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ConfigCatCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ConfigCatCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ConfigCatCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public ConfigCatCredentialsUpdate(ConfigCatSDKKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ConfigCatSDKKeyUpdate", new GenericType() {}); + JSON.registerDescendants( + ConfigCatCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ConfigCatCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ConfigCatSDKKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ConfigCatSDKKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ConfigCatSDKKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: ConfigCatSDKKeyUpdate + * + * @return The actual instance (ConfigCatSDKKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ConfigCatSDKKeyUpdate`. If the actual instance is not + * `ConfigCatSDKKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `ConfigCatSDKKeyUpdate` + * @throws ClassCastException if the instance is not `ConfigCatSDKKeyUpdate` + */ + public ConfigCatSDKKeyUpdate getConfigCatSDKKeyUpdate() throws ClassCastException { + return (ConfigCatSDKKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegration.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegration.java new file mode 100644 index 00000000000..83b5111b49b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ConfigCatIntegration object. */ +@JsonPropertyOrder({ + ConfigCatIntegration.JSON_PROPERTY_CREDENTIALS, + ConfigCatIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConfigCatIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private ConfigCatCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConfigCatIntegrationType type; + + public ConfigCatIntegration() {} + + @JsonCreator + public ConfigCatIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + ConfigCatCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ConfigCatIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ConfigCatIntegration credentials(ConfigCatCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the ConfigCatCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConfigCatCredentials getCredentials() { + return credentials; + } + + public void setCredentials(ConfigCatCredentials credentials) { + this.credentials = credentials; + } + + public ConfigCatIntegration type(ConfigCatIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ConfigCatIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConfigCatIntegrationType getType() { + return type; + } + + public void setType(ConfigCatIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConfigCatIntegration + */ + @JsonAnySetter + public ConfigCatIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConfigCatIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigCatIntegration configCatIntegration = (ConfigCatIntegration) o; + return Objects.equals(this.credentials, configCatIntegration.credentials) + && Objects.equals(this.type, configCatIntegration.type) + && Objects.equals(this.additionalProperties, configCatIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigCatIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegrationType.java new file mode 100644 index 00000000000..986f36f5b74 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegrationType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the ConfigCatIntegrationType object. */ +@JsonSerialize(using = ConfigCatIntegrationType.ConfigCatIntegrationTypeSerializer.class) +public class ConfigCatIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("ConfigCat")); + + public static final ConfigCatIntegrationType CONFIGCAT = + new ConfigCatIntegrationType("ConfigCat"); + + ConfigCatIntegrationType(String value) { + super(value, allowedValues); + } + + public static class ConfigCatIntegrationTypeSerializer + extends StdSerializer { + public ConfigCatIntegrationTypeSerializer(Class t) { + super(t); + } + + public ConfigCatIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ConfigCatIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ConfigCatIntegrationType fromValue(String value) { + return new ConfigCatIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegrationUpdate.java new file mode 100644 index 00000000000..edf0bcc8d33 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ConfigCatIntegrationUpdate object. */ +@JsonPropertyOrder({ + ConfigCatIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + ConfigCatIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConfigCatIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private ConfigCatCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConfigCatIntegrationType type; + + public ConfigCatIntegrationUpdate() {} + + @JsonCreator + public ConfigCatIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ConfigCatIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ConfigCatIntegrationUpdate credentials(ConfigCatCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the ConfigCatCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConfigCatCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(ConfigCatCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public ConfigCatIntegrationUpdate type(ConfigCatIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ConfigCatIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConfigCatIntegrationType getType() { + return type; + } + + public void setType(ConfigCatIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConfigCatIntegrationUpdate + */ + @JsonAnySetter + public ConfigCatIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConfigCatIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigCatIntegrationUpdate configCatIntegrationUpdate = (ConfigCatIntegrationUpdate) o; + return Objects.equals(this.credentials, configCatIntegrationUpdate.credentials) + && Objects.equals(this.type, configCatIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, configCatIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigCatIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKey.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKey.java new file mode 100644 index 00000000000..f7fb71ca5ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKey.java @@ -0,0 +1,234 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ConfigCatSDKKey object. */ +@JsonPropertyOrder({ + ConfigCatSDKKey.JSON_PROPERTY_API_PASSWORD, + ConfigCatSDKKey.JSON_PROPERTY_API_USERNAME, + ConfigCatSDKKey.JSON_PROPERTY_SDK_KEY, + ConfigCatSDKKey.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConfigCatSDKKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_PASSWORD = "api_password"; + private String apiPassword; + + public static final String JSON_PROPERTY_API_USERNAME = "api_username"; + private String apiUsername; + + public static final String JSON_PROPERTY_SDK_KEY = "sdk_key"; + private String sdkKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConfigCatSDKKeyType type; + + public ConfigCatSDKKey() {} + + @JsonCreator + public ConfigCatSDKKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_PASSWORD) String apiPassword, + @JsonProperty(required = true, value = JSON_PROPERTY_API_USERNAME) String apiUsername, + @JsonProperty(required = true, value = JSON_PROPERTY_SDK_KEY) String sdkKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ConfigCatSDKKeyType type) { + this.apiPassword = apiPassword; + this.apiUsername = apiUsername; + this.sdkKey = sdkKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ConfigCatSDKKey apiPassword(String apiPassword) { + this.apiPassword = apiPassword; + return this; + } + + /** + * The ConfigCatSDKKey api_password. + * + * @return apiPassword + */ + @JsonProperty(JSON_PROPERTY_API_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiPassword() { + return apiPassword; + } + + public void setApiPassword(String apiPassword) { + this.apiPassword = apiPassword; + } + + public ConfigCatSDKKey apiUsername(String apiUsername) { + this.apiUsername = apiUsername; + return this; + } + + /** + * The ConfigCatSDKKey api_username. + * + * @return apiUsername + */ + @JsonProperty(JSON_PROPERTY_API_USERNAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiUsername() { + return apiUsername; + } + + public void setApiUsername(String apiUsername) { + this.apiUsername = apiUsername; + } + + public ConfigCatSDKKey sdkKey(String sdkKey) { + this.sdkKey = sdkKey; + return this; + } + + /** + * The ConfigCatSDKKey sdk_key. + * + * @return sdkKey + */ + @JsonProperty(JSON_PROPERTY_SDK_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSdkKey() { + return sdkKey; + } + + public void setSdkKey(String sdkKey) { + this.sdkKey = sdkKey; + } + + public ConfigCatSDKKey type(ConfigCatSDKKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ConfigCatSDKKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConfigCatSDKKeyType getType() { + return type; + } + + public void setType(ConfigCatSDKKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConfigCatSDKKey + */ + @JsonAnySetter + public ConfigCatSDKKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConfigCatSDKKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigCatSDKKey configCatSdkKey = (ConfigCatSDKKey) o; + return Objects.equals(this.apiPassword, configCatSdkKey.apiPassword) + && Objects.equals(this.apiUsername, configCatSdkKey.apiUsername) + && Objects.equals(this.sdkKey, configCatSdkKey.sdkKey) + && Objects.equals(this.type, configCatSdkKey.type) + && Objects.equals(this.additionalProperties, configCatSdkKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiPassword, apiUsername, sdkKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigCatSDKKey {\n"); + sb.append(" apiPassword: ").append(toIndentedString(apiPassword)).append("\n"); + sb.append(" apiUsername: ").append(toIndentedString(apiUsername)).append("\n"); + sb.append(" sdkKey: ").append(toIndentedString(sdkKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKeyType.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKeyType.java new file mode 100644 index 00000000000..a2889dfe401 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKeyType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the ConfigCatSDKKey object. */ +@JsonSerialize(using = ConfigCatSDKKeyType.ConfigCatSDKKeyTypeSerializer.class) +public class ConfigCatSDKKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ConfigCatSDKKey")); + + public static final ConfigCatSDKKeyType CONFIGCATSDKKEY = + new ConfigCatSDKKeyType("ConfigCatSDKKey"); + + ConfigCatSDKKeyType(String value) { + super(value, allowedValues); + } + + public static class ConfigCatSDKKeyTypeSerializer extends StdSerializer { + public ConfigCatSDKKeyTypeSerializer(Class t) { + super(t); + } + + public ConfigCatSDKKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ConfigCatSDKKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ConfigCatSDKKeyType fromValue(String value) { + return new ConfigCatSDKKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKeyUpdate.java new file mode 100644 index 00000000000..547b7282484 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConfigCatSDKKeyUpdate.java @@ -0,0 +1,231 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ConfigCatSDKKey object. */ +@JsonPropertyOrder({ + ConfigCatSDKKeyUpdate.JSON_PROPERTY_API_PASSWORD, + ConfigCatSDKKeyUpdate.JSON_PROPERTY_API_USERNAME, + ConfigCatSDKKeyUpdate.JSON_PROPERTY_SDK_KEY, + ConfigCatSDKKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConfigCatSDKKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_PASSWORD = "api_password"; + private String apiPassword; + + public static final String JSON_PROPERTY_API_USERNAME = "api_username"; + private String apiUsername; + + public static final String JSON_PROPERTY_SDK_KEY = "sdk_key"; + private String sdkKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConfigCatSDKKeyType type; + + public ConfigCatSDKKeyUpdate() {} + + @JsonCreator + public ConfigCatSDKKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ConfigCatSDKKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ConfigCatSDKKeyUpdate apiPassword(String apiPassword) { + this.apiPassword = apiPassword; + return this; + } + + /** + * The ConfigCatSDKKeyUpdate api_password. + * + * @return apiPassword + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiPassword() { + return apiPassword; + } + + public void setApiPassword(String apiPassword) { + this.apiPassword = apiPassword; + } + + public ConfigCatSDKKeyUpdate apiUsername(String apiUsername) { + this.apiUsername = apiUsername; + return this; + } + + /** + * The ConfigCatSDKKeyUpdate api_username. + * + * @return apiUsername + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiUsername() { + return apiUsername; + } + + public void setApiUsername(String apiUsername) { + this.apiUsername = apiUsername; + } + + public ConfigCatSDKKeyUpdate sdkKey(String sdkKey) { + this.sdkKey = sdkKey; + return this; + } + + /** + * The ConfigCatSDKKeyUpdate sdk_key. + * + * @return sdkKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SDK_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSdkKey() { + return sdkKey; + } + + public void setSdkKey(String sdkKey) { + this.sdkKey = sdkKey; + } + + public ConfigCatSDKKeyUpdate type(ConfigCatSDKKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ConfigCatSDKKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConfigCatSDKKeyType getType() { + return type; + } + + public void setType(ConfigCatSDKKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConfigCatSDKKeyUpdate + */ + @JsonAnySetter + public ConfigCatSDKKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConfigCatSDKKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigCatSDKKeyUpdate configCatSdkKeyUpdate = (ConfigCatSDKKeyUpdate) o; + return Objects.equals(this.apiPassword, configCatSdkKeyUpdate.apiPassword) + && Objects.equals(this.apiUsername, configCatSdkKeyUpdate.apiUsername) + && Objects.equals(this.sdkKey, configCatSdkKeyUpdate.sdkKey) + && Objects.equals(this.type, configCatSdkKeyUpdate.type) + && Objects.equals(this.additionalProperties, configCatSdkKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiPassword, apiUsername, sdkKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigCatSDKKeyUpdate {\n"); + sb.append(" apiPassword: ").append(toIndentedString(apiPassword)).append("\n"); + sb.append(" apiUsername: ").append(toIndentedString(apiUsername)).append("\n"); + sb.append(" sdkKey: ").append(toIndentedString(sdkKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKey.java new file mode 100644 index 00000000000..568441ec38c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FastlyAPIKey object. */ +@JsonPropertyOrder({FastlyAPIKey.JSON_PROPERTY_API_KEY, FastlyAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FastlyAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FastlyAPIKeyType type; + + public FastlyAPIKey() {} + + @JsonCreator + public FastlyAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FastlyAPIKeyType type) { + this.apiKey = apiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FastlyAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The FastlyAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public FastlyAPIKey type(FastlyAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FastlyAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FastlyAPIKeyType getType() { + return type; + } + + public void setType(FastlyAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FastlyAPIKey + */ + @JsonAnySetter + public FastlyAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FastlyAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FastlyAPIKey fastlyApiKey = (FastlyAPIKey) o; + return Objects.equals(this.apiKey, fastlyApiKey.apiKey) + && Objects.equals(this.type, fastlyApiKey.type) + && Objects.equals(this.additionalProperties, fastlyApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FastlyAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKeyType.java new file mode 100644 index 00000000000..c9626144239 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the FastlyAPIKey object. */ +@JsonSerialize(using = FastlyAPIKeyType.FastlyAPIKeyTypeSerializer.class) +public class FastlyAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("FastlyAPIKey")); + + public static final FastlyAPIKeyType FASTLYAPIKEY = new FastlyAPIKeyType("FastlyAPIKey"); + + FastlyAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class FastlyAPIKeyTypeSerializer extends StdSerializer { + public FastlyAPIKeyTypeSerializer(Class t) { + super(t); + } + + public FastlyAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(FastlyAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FastlyAPIKeyType fromValue(String value) { + return new FastlyAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKeyUpdate.java new file mode 100644 index 00000000000..0965c431e06 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FastlyAPIKey object. */ +@JsonPropertyOrder({ + FastlyAPIKeyUpdate.JSON_PROPERTY_API_KEY, + FastlyAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FastlyAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FastlyAPIKeyType type; + + public FastlyAPIKeyUpdate() {} + + @JsonCreator + public FastlyAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FastlyAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FastlyAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The FastlyAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public FastlyAPIKeyUpdate type(FastlyAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FastlyAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FastlyAPIKeyType getType() { + return type; + } + + public void setType(FastlyAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FastlyAPIKeyUpdate + */ + @JsonAnySetter + public FastlyAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FastlyAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FastlyAPIKeyUpdate fastlyApiKeyUpdate = (FastlyAPIKeyUpdate) o; + return Objects.equals(this.apiKey, fastlyApiKeyUpdate.apiKey) + && Objects.equals(this.type, fastlyApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, fastlyApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FastlyAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyCredentials.java b/src/main/java/com/datadog/api/client/v2/model/FastlyCredentials.java new file mode 100644 index 00000000000..22d6b58e4d2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = FastlyCredentials.FastlyCredentialsDeserializer.class) +@JsonSerialize(using = FastlyCredentials.FastlyCredentialsSerializer.class) +public class FastlyCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FastlyCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class FastlyCredentialsSerializer extends StdSerializer { + public FastlyCredentialsSerializer(Class t) { + super(t); + } + + public FastlyCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(FastlyCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FastlyCredentialsDeserializer extends StdDeserializer { + public FastlyCredentialsDeserializer() { + this(FastlyCredentials.class); + } + + public FastlyCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public FastlyCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize FastlyAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (FastlyAPIKey.class.equals(Integer.class) + || FastlyAPIKey.class.equals(Long.class) + || FastlyAPIKey.class.equals(Float.class) + || FastlyAPIKey.class.equals(Double.class) + || FastlyAPIKey.class.equals(Boolean.class) + || FastlyAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((FastlyAPIKey.class.equals(Integer.class) || FastlyAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((FastlyAPIKey.class.equals(Float.class) || FastlyAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (FastlyAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (FastlyAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FastlyAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FastlyAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FastlyAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FastlyAPIKey'", e); + } + + FastlyCredentials ret = new FastlyCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public FastlyCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FastlyCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public FastlyCredentials() { + super("oneOf", Boolean.FALSE); + } + + public FastlyCredentials(FastlyAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("FastlyAPIKey", new GenericType() {}); + JSON.registerDescendants(FastlyCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return FastlyCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: FastlyAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(FastlyAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be FastlyAPIKey"); + } + + /** + * Get the actual instance, which can be the following: FastlyAPIKey + * + * @return The actual instance (FastlyAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `FastlyAPIKey`. If the actual instance is not `FastlyAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `FastlyAPIKey` + * @throws ClassCastException if the instance is not `FastlyAPIKey` + */ + public FastlyAPIKey getFastlyAPIKey() throws ClassCastException { + return (FastlyAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/FastlyCredentialsUpdate.java new file mode 100644 index 00000000000..fb304760eaf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = FastlyCredentialsUpdate.FastlyCredentialsUpdateDeserializer.class) +@JsonSerialize(using = FastlyCredentialsUpdate.FastlyCredentialsUpdateSerializer.class) +public class FastlyCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FastlyCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class FastlyCredentialsUpdateSerializer + extends StdSerializer { + public FastlyCredentialsUpdateSerializer(Class t) { + super(t); + } + + public FastlyCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + FastlyCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FastlyCredentialsUpdateDeserializer + extends StdDeserializer { + public FastlyCredentialsUpdateDeserializer() { + this(FastlyCredentialsUpdate.class); + } + + public FastlyCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public FastlyCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize FastlyAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (FastlyAPIKeyUpdate.class.equals(Integer.class) + || FastlyAPIKeyUpdate.class.equals(Long.class) + || FastlyAPIKeyUpdate.class.equals(Float.class) + || FastlyAPIKeyUpdate.class.equals(Double.class) + || FastlyAPIKeyUpdate.class.equals(Boolean.class) + || FastlyAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((FastlyAPIKeyUpdate.class.equals(Integer.class) + || FastlyAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((FastlyAPIKeyUpdate.class.equals(Float.class) + || FastlyAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (FastlyAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (FastlyAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FastlyAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FastlyAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FastlyAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FastlyAPIKeyUpdate'", e); + } + + FastlyCredentialsUpdate ret = new FastlyCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public FastlyCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FastlyCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public FastlyCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public FastlyCredentialsUpdate(FastlyAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("FastlyAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(FastlyCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return FastlyCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: FastlyAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(FastlyAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be FastlyAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: FastlyAPIKeyUpdate + * + * @return The actual instance (FastlyAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `FastlyAPIKeyUpdate`. If the actual instance is not + * `FastlyAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `FastlyAPIKeyUpdate` + * @throws ClassCastException if the instance is not `FastlyAPIKeyUpdate` + */ + public FastlyAPIKeyUpdate getFastlyAPIKeyUpdate() throws ClassCastException { + return (FastlyAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyIntegration.java b/src/main/java/com/datadog/api/client/v2/model/FastlyIntegration.java new file mode 100644 index 00000000000..32d9e2f2cfb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FastlyIntegration object. */ +@JsonPropertyOrder({ + FastlyIntegration.JSON_PROPERTY_CREDENTIALS, + FastlyIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FastlyIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private FastlyCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FastlyIntegrationType type; + + public FastlyIntegration() {} + + @JsonCreator + public FastlyIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + FastlyCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FastlyIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FastlyIntegration credentials(FastlyCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the FastlyCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FastlyCredentials getCredentials() { + return credentials; + } + + public void setCredentials(FastlyCredentials credentials) { + this.credentials = credentials; + } + + public FastlyIntegration type(FastlyIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FastlyIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FastlyIntegrationType getType() { + return type; + } + + public void setType(FastlyIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FastlyIntegration + */ + @JsonAnySetter + public FastlyIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FastlyIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FastlyIntegration fastlyIntegration = (FastlyIntegration) o; + return Objects.equals(this.credentials, fastlyIntegration.credentials) + && Objects.equals(this.type, fastlyIntegration.type) + && Objects.equals(this.additionalProperties, fastlyIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FastlyIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/FastlyIntegrationType.java new file mode 100644 index 00000000000..035c4caa8ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the FastlyIntegrationType object. */ +@JsonSerialize(using = FastlyIntegrationType.FastlyIntegrationTypeSerializer.class) +public class FastlyIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Fastly")); + + public static final FastlyIntegrationType FASTLY = new FastlyIntegrationType("Fastly"); + + FastlyIntegrationType(String value) { + super(value, allowedValues); + } + + public static class FastlyIntegrationTypeSerializer extends StdSerializer { + public FastlyIntegrationTypeSerializer(Class t) { + super(t); + } + + public FastlyIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FastlyIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FastlyIntegrationType fromValue(String value) { + return new FastlyIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FastlyIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/FastlyIntegrationUpdate.java new file mode 100644 index 00000000000..c2b5a4b59c6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FastlyIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FastlyIntegrationUpdate object. */ +@JsonPropertyOrder({ + FastlyIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + FastlyIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FastlyIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private FastlyCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FastlyIntegrationType type; + + public FastlyIntegrationUpdate() {} + + @JsonCreator + public FastlyIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FastlyIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FastlyIntegrationUpdate credentials(FastlyCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the FastlyCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FastlyCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(FastlyCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public FastlyIntegrationUpdate type(FastlyIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FastlyIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FastlyIntegrationType getType() { + return type; + } + + public void setType(FastlyIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FastlyIntegrationUpdate + */ + @JsonAnySetter + public FastlyIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FastlyIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FastlyIntegrationUpdate fastlyIntegrationUpdate = (FastlyIntegrationUpdate) o; + return Objects.equals(this.credentials, fastlyIntegrationUpdate.credentials) + && Objects.equals(this.type, fastlyIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, fastlyIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FastlyIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKey.java new file mode 100644 index 00000000000..214e88989ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKey.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FreshserviceAPIKey object. */ +@JsonPropertyOrder({ + FreshserviceAPIKey.JSON_PROPERTY_API_KEY, + FreshserviceAPIKey.JSON_PROPERTY_DOMAIN, + FreshserviceAPIKey.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FreshserviceAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + private String domain; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FreshserviceAPIKeyType type; + + public FreshserviceAPIKey() {} + + @JsonCreator + public FreshserviceAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_DOMAIN) String domain, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FreshserviceAPIKeyType type) { + this.apiKey = apiKey; + this.domain = domain; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FreshserviceAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The FreshserviceAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public FreshserviceAPIKey domain(String domain) { + this.domain = domain; + return this; + } + + /** + * The FreshserviceAPIKey domain. + * + * @return domain + */ + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public FreshserviceAPIKey type(FreshserviceAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FreshserviceAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FreshserviceAPIKeyType getType() { + return type; + } + + public void setType(FreshserviceAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FreshserviceAPIKey + */ + @JsonAnySetter + public FreshserviceAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FreshserviceAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FreshserviceAPIKey freshserviceApiKey = (FreshserviceAPIKey) o; + return Objects.equals(this.apiKey, freshserviceApiKey.apiKey) + && Objects.equals(this.domain, freshserviceApiKey.domain) + && Objects.equals(this.type, freshserviceApiKey.type) + && Objects.equals(this.additionalProperties, freshserviceApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, domain, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreshserviceAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKeyType.java new file mode 100644 index 00000000000..adcbc87cc7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKeyType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the FreshserviceAPIKey object. */ +@JsonSerialize(using = FreshserviceAPIKeyType.FreshserviceAPIKeyTypeSerializer.class) +public class FreshserviceAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("FreshserviceAPIKey")); + + public static final FreshserviceAPIKeyType FRESHSERVICEAPIKEY = + new FreshserviceAPIKeyType("FreshserviceAPIKey"); + + FreshserviceAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class FreshserviceAPIKeyTypeSerializer + extends StdSerializer { + public FreshserviceAPIKeyTypeSerializer(Class t) { + super(t); + } + + public FreshserviceAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FreshserviceAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FreshserviceAPIKeyType fromValue(String value) { + return new FreshserviceAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKeyUpdate.java new file mode 100644 index 00000000000..04eef1e1cba --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceAPIKeyUpdate.java @@ -0,0 +1,204 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FreshserviceAPIKey object. */ +@JsonPropertyOrder({ + FreshserviceAPIKeyUpdate.JSON_PROPERTY_API_KEY, + FreshserviceAPIKeyUpdate.JSON_PROPERTY_DOMAIN, + FreshserviceAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FreshserviceAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + private String domain; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FreshserviceAPIKeyType type; + + public FreshserviceAPIKeyUpdate() {} + + @JsonCreator + public FreshserviceAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FreshserviceAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FreshserviceAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The FreshserviceAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public FreshserviceAPIKeyUpdate domain(String domain) { + this.domain = domain; + return this; + } + + /** + * The FreshserviceAPIKeyUpdate domain. + * + * @return domain + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public FreshserviceAPIKeyUpdate type(FreshserviceAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FreshserviceAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FreshserviceAPIKeyType getType() { + return type; + } + + public void setType(FreshserviceAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FreshserviceAPIKeyUpdate + */ + @JsonAnySetter + public FreshserviceAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FreshserviceAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FreshserviceAPIKeyUpdate freshserviceApiKeyUpdate = (FreshserviceAPIKeyUpdate) o; + return Objects.equals(this.apiKey, freshserviceApiKeyUpdate.apiKey) + && Objects.equals(this.domain, freshserviceApiKeyUpdate.domain) + && Objects.equals(this.type, freshserviceApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, freshserviceApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, domain, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreshserviceAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceCredentials.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceCredentials.java new file mode 100644 index 00000000000..fdc8a306e8f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceCredentials.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = FreshserviceCredentials.FreshserviceCredentialsDeserializer.class) +@JsonSerialize(using = FreshserviceCredentials.FreshserviceCredentialsSerializer.class) +public class FreshserviceCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FreshserviceCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class FreshserviceCredentialsSerializer + extends StdSerializer { + public FreshserviceCredentialsSerializer(Class t) { + super(t); + } + + public FreshserviceCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + FreshserviceCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FreshserviceCredentialsDeserializer + extends StdDeserializer { + public FreshserviceCredentialsDeserializer() { + this(FreshserviceCredentials.class); + } + + public FreshserviceCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public FreshserviceCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize FreshserviceAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (FreshserviceAPIKey.class.equals(Integer.class) + || FreshserviceAPIKey.class.equals(Long.class) + || FreshserviceAPIKey.class.equals(Float.class) + || FreshserviceAPIKey.class.equals(Double.class) + || FreshserviceAPIKey.class.equals(Boolean.class) + || FreshserviceAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((FreshserviceAPIKey.class.equals(Integer.class) + || FreshserviceAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((FreshserviceAPIKey.class.equals(Float.class) + || FreshserviceAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (FreshserviceAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (FreshserviceAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FreshserviceAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FreshserviceAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FreshserviceAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FreshserviceAPIKey'", e); + } + + FreshserviceCredentials ret = new FreshserviceCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public FreshserviceCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FreshserviceCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public FreshserviceCredentials() { + super("oneOf", Boolean.FALSE); + } + + public FreshserviceCredentials(FreshserviceAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("FreshserviceAPIKey", new GenericType() {}); + JSON.registerDescendants(FreshserviceCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return FreshserviceCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: FreshserviceAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(FreshserviceAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be FreshserviceAPIKey"); + } + + /** + * Get the actual instance, which can be the following: FreshserviceAPIKey + * + * @return The actual instance (FreshserviceAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `FreshserviceAPIKey`. If the actual instance is not + * `FreshserviceAPIKey`, the ClassCastException will be thrown. + * + * @return The actual instance of `FreshserviceAPIKey` + * @throws ClassCastException if the instance is not `FreshserviceAPIKey` + */ + public FreshserviceAPIKey getFreshserviceAPIKey() throws ClassCastException { + return (FreshserviceAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceCredentialsUpdate.java new file mode 100644 index 00000000000..3f975340219 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceCredentialsUpdate.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = FreshserviceCredentialsUpdate.FreshserviceCredentialsUpdateDeserializer.class) +@JsonSerialize(using = FreshserviceCredentialsUpdate.FreshserviceCredentialsUpdateSerializer.class) +public class FreshserviceCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FreshserviceCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class FreshserviceCredentialsUpdateSerializer + extends StdSerializer { + public FreshserviceCredentialsUpdateSerializer(Class t) { + super(t); + } + + public FreshserviceCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + FreshserviceCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FreshserviceCredentialsUpdateDeserializer + extends StdDeserializer { + public FreshserviceCredentialsUpdateDeserializer() { + this(FreshserviceCredentialsUpdate.class); + } + + public FreshserviceCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public FreshserviceCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize FreshserviceAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (FreshserviceAPIKeyUpdate.class.equals(Integer.class) + || FreshserviceAPIKeyUpdate.class.equals(Long.class) + || FreshserviceAPIKeyUpdate.class.equals(Float.class) + || FreshserviceAPIKeyUpdate.class.equals(Double.class) + || FreshserviceAPIKeyUpdate.class.equals(Boolean.class) + || FreshserviceAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((FreshserviceAPIKeyUpdate.class.equals(Integer.class) + || FreshserviceAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((FreshserviceAPIKeyUpdate.class.equals(Float.class) + || FreshserviceAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (FreshserviceAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (FreshserviceAPIKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(FreshserviceAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((FreshserviceAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'FreshserviceAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'FreshserviceAPIKeyUpdate'", e); + } + + FreshserviceCredentialsUpdate ret = new FreshserviceCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public FreshserviceCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "FreshserviceCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public FreshserviceCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public FreshserviceCredentialsUpdate(FreshserviceAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("FreshserviceAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants( + FreshserviceCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return FreshserviceCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: FreshserviceAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(FreshserviceAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be FreshserviceAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: FreshserviceAPIKeyUpdate + * + * @return The actual instance (FreshserviceAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `FreshserviceAPIKeyUpdate`. If the actual instance is not + * `FreshserviceAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `FreshserviceAPIKeyUpdate` + * @throws ClassCastException if the instance is not `FreshserviceAPIKeyUpdate` + */ + public FreshserviceAPIKeyUpdate getFreshserviceAPIKeyUpdate() throws ClassCastException { + return (FreshserviceAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegration.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegration.java new file mode 100644 index 00000000000..8a659de06d7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FreshserviceIntegration object. */ +@JsonPropertyOrder({ + FreshserviceIntegration.JSON_PROPERTY_CREDENTIALS, + FreshserviceIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FreshserviceIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private FreshserviceCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FreshserviceIntegrationType type; + + public FreshserviceIntegration() {} + + @JsonCreator + public FreshserviceIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + FreshserviceCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FreshserviceIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FreshserviceIntegration credentials(FreshserviceCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the FreshserviceCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FreshserviceCredentials getCredentials() { + return credentials; + } + + public void setCredentials(FreshserviceCredentials credentials) { + this.credentials = credentials; + } + + public FreshserviceIntegration type(FreshserviceIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FreshserviceIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FreshserviceIntegrationType getType() { + return type; + } + + public void setType(FreshserviceIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FreshserviceIntegration + */ + @JsonAnySetter + public FreshserviceIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FreshserviceIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FreshserviceIntegration freshserviceIntegration = (FreshserviceIntegration) o; + return Objects.equals(this.credentials, freshserviceIntegration.credentials) + && Objects.equals(this.type, freshserviceIntegration.type) + && Objects.equals(this.additionalProperties, freshserviceIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreshserviceIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegrationType.java new file mode 100644 index 00000000000..1ae1765a72a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegrationType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the FreshserviceIntegrationType object. */ +@JsonSerialize(using = FreshserviceIntegrationType.FreshserviceIntegrationTypeSerializer.class) +public class FreshserviceIntegrationType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("Freshservice")); + + public static final FreshserviceIntegrationType FRESHSERVICE = + new FreshserviceIntegrationType("Freshservice"); + + FreshserviceIntegrationType(String value) { + super(value, allowedValues); + } + + public static class FreshserviceIntegrationTypeSerializer + extends StdSerializer { + public FreshserviceIntegrationTypeSerializer(Class t) { + super(t); + } + + public FreshserviceIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FreshserviceIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FreshserviceIntegrationType fromValue(String value) { + return new FreshserviceIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegrationUpdate.java new file mode 100644 index 00000000000..302c9b4c8b5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FreshserviceIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the FreshserviceIntegrationUpdate object. */ +@JsonPropertyOrder({ + FreshserviceIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + FreshserviceIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FreshserviceIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private FreshserviceCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FreshserviceIntegrationType type; + + public FreshserviceIntegrationUpdate() {} + + @JsonCreator + public FreshserviceIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FreshserviceIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FreshserviceIntegrationUpdate credentials(FreshserviceCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the FreshserviceCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FreshserviceCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(FreshserviceCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public FreshserviceIntegrationUpdate type(FreshserviceIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the FreshserviceIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FreshserviceIntegrationType getType() { + return type; + } + + public void setType(FreshserviceIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FreshserviceIntegrationUpdate + */ + @JsonAnySetter + public FreshserviceIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FreshserviceIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FreshserviceIntegrationUpdate freshserviceIntegrationUpdate = (FreshserviceIntegrationUpdate) o; + return Objects.equals(this.credentials, freshserviceIntegrationUpdate.credentials) + && Objects.equals(this.type, freshserviceIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, freshserviceIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreshserviceIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPCredentials.java b/src/main/java/com/datadog/api/client/v2/model/GCPCredentials.java new file mode 100644 index 00000000000..79d22442224 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPCredentials.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GCPCredentials.GCPCredentialsDeserializer.class) +@JsonSerialize(using = GCPCredentials.GCPCredentialsSerializer.class) +public class GCPCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GCPCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GCPCredentialsSerializer extends StdSerializer { + public GCPCredentialsSerializer(Class t) { + super(t); + } + + public GCPCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(GCPCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GCPCredentialsDeserializer extends StdDeserializer { + public GCPCredentialsDeserializer() { + this(GCPCredentials.class); + } + + public GCPCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public GCPCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GCPServiceAccount + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GCPServiceAccount.class.equals(Integer.class) + || GCPServiceAccount.class.equals(Long.class) + || GCPServiceAccount.class.equals(Float.class) + || GCPServiceAccount.class.equals(Double.class) + || GCPServiceAccount.class.equals(Boolean.class) + || GCPServiceAccount.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GCPServiceAccount.class.equals(Integer.class) + || GCPServiceAccount.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GCPServiceAccount.class.equals(Float.class) + || GCPServiceAccount.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GCPServiceAccount.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GCPServiceAccount.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GCPServiceAccount.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GCPServiceAccount) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GCPServiceAccount'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GCPServiceAccount'", e); + } + + GCPCredentials ret = new GCPCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GCPCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GCPCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GCPCredentials() { + super("oneOf", Boolean.FALSE); + } + + public GCPCredentials(GCPServiceAccount o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GCPServiceAccount", new GenericType() {}); + JSON.registerDescendants(GCPCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GCPCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GCPServiceAccount + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GCPServiceAccount.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GCPServiceAccount"); + } + + /** + * Get the actual instance, which can be the following: GCPServiceAccount + * + * @return The actual instance (GCPServiceAccount) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GCPServiceAccount`. If the actual instance is not + * `GCPServiceAccount`, the ClassCastException will be thrown. + * + * @return The actual instance of `GCPServiceAccount` + * @throws ClassCastException if the instance is not `GCPServiceAccount` + */ + public GCPServiceAccount getGCPServiceAccount() throws ClassCastException { + return (GCPServiceAccount) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GCPCredentialsUpdate.java new file mode 100644 index 00000000000..838df061a2e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GCPCredentialsUpdate.GCPCredentialsUpdateDeserializer.class) +@JsonSerialize(using = GCPCredentialsUpdate.GCPCredentialsUpdateSerializer.class) +public class GCPCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GCPCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GCPCredentialsUpdateSerializer extends StdSerializer { + public GCPCredentialsUpdateSerializer(Class t) { + super(t); + } + + public GCPCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + GCPCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GCPCredentialsUpdateDeserializer + extends StdDeserializer { + public GCPCredentialsUpdateDeserializer() { + this(GCPCredentialsUpdate.class); + } + + public GCPCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public GCPCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GCPServiceAccountUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GCPServiceAccountUpdate.class.equals(Integer.class) + || GCPServiceAccountUpdate.class.equals(Long.class) + || GCPServiceAccountUpdate.class.equals(Float.class) + || GCPServiceAccountUpdate.class.equals(Double.class) + || GCPServiceAccountUpdate.class.equals(Boolean.class) + || GCPServiceAccountUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GCPServiceAccountUpdate.class.equals(Integer.class) + || GCPServiceAccountUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GCPServiceAccountUpdate.class.equals(Float.class) + || GCPServiceAccountUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GCPServiceAccountUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GCPServiceAccountUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GCPServiceAccountUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GCPServiceAccountUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GCPServiceAccountUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GCPServiceAccountUpdate'", e); + } + + GCPCredentialsUpdate ret = new GCPCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GCPCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GCPCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GCPCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public GCPCredentialsUpdate(GCPServiceAccountUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GCPServiceAccountUpdate", new GenericType() {}); + JSON.registerDescendants(GCPCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GCPCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GCPServiceAccountUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GCPServiceAccountUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GCPServiceAccountUpdate"); + } + + /** + * Get the actual instance, which can be the following: GCPServiceAccountUpdate + * + * @return The actual instance (GCPServiceAccountUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GCPServiceAccountUpdate`. If the actual instance is not + * `GCPServiceAccountUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GCPServiceAccountUpdate` + * @throws ClassCastException if the instance is not `GCPServiceAccountUpdate` + */ + public GCPServiceAccountUpdate getGCPServiceAccountUpdate() throws ClassCastException { + return (GCPServiceAccountUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPIntegration.java b/src/main/java/com/datadog/api/client/v2/model/GCPIntegration.java new file mode 100644 index 00000000000..39f0e1b2e21 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPIntegration.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GCPIntegration object. */ +@JsonPropertyOrder({GCPIntegration.JSON_PROPERTY_CREDENTIALS, GCPIntegration.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GCPCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPIntegrationType type; + + public GCPIntegration() {} + + @JsonCreator + public GCPIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) GCPCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GCPIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPIntegration credentials(GCPCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GCPCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPCredentials getCredentials() { + return credentials; + } + + public void setCredentials(GCPCredentials credentials) { + this.credentials = credentials; + } + + public GCPIntegration type(GCPIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GCPIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPIntegrationType getType() { + return type; + } + + public void setType(GCPIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPIntegration + */ + @JsonAnySetter + public GCPIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPIntegration gcpIntegration = (GCPIntegration) o; + return Objects.equals(this.credentials, gcpIntegration.credentials) + && Objects.equals(this.type, gcpIntegration.type) + && Objects.equals(this.additionalProperties, gcpIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/GCPIntegrationType.java new file mode 100644 index 00000000000..b82b71a89ec --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPIntegrationType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GCPIntegrationType object. */ +@JsonSerialize(using = GCPIntegrationType.GCPIntegrationTypeSerializer.class) +public class GCPIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("GCP")); + + public static final GCPIntegrationType GCP = new GCPIntegrationType("GCP"); + + GCPIntegrationType(String value) { + super(value, allowedValues); + } + + public static class GCPIntegrationTypeSerializer extends StdSerializer { + public GCPIntegrationTypeSerializer(Class t) { + super(t); + } + + public GCPIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize(GCPIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPIntegrationType fromValue(String value) { + return new GCPIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GCPIntegrationUpdate.java new file mode 100644 index 00000000000..4f7a1c1def7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GCPIntegrationUpdate object. */ +@JsonPropertyOrder({ + GCPIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + GCPIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GCPCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPIntegrationType type; + + public GCPIntegrationUpdate() {} + + @JsonCreator + public GCPIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GCPIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPIntegrationUpdate credentials(GCPCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GCPCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(GCPCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public GCPIntegrationUpdate type(GCPIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GCPIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPIntegrationType getType() { + return type; + } + + public void setType(GCPIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPIntegrationUpdate + */ + @JsonAnySetter + public GCPIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPIntegrationUpdate gcpIntegrationUpdate = (GCPIntegrationUpdate) o; + return Objects.equals(this.credentials, gcpIntegrationUpdate.credentials) + && Objects.equals(this.type, gcpIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, gcpIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccount.java b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccount.java new file mode 100644 index 00000000000..4a71bc0680d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccount.java @@ -0,0 +1,210 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GCPServiceAccount object. */ +@JsonPropertyOrder({ + GCPServiceAccount.JSON_PROPERTY_PRIVATE_KEY, + GCPServiceAccount.JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL, + GCPServiceAccount.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPServiceAccount { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PRIVATE_KEY = "private_key"; + private String privateKey; + + public static final String JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL = "service_account_email"; + private String serviceAccountEmail; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPServiceAccountCredentialType type; + + public GCPServiceAccount() {} + + @JsonCreator + public GCPServiceAccount( + @JsonProperty(required = true, value = JSON_PROPERTY_PRIVATE_KEY) String privateKey, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL) + String serviceAccountEmail, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GCPServiceAccountCredentialType type) { + this.privateKey = privateKey; + this.serviceAccountEmail = serviceAccountEmail; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPServiceAccount privateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * The GCPServiceAccount private_key. + * + * @return privateKey + */ + @JsonProperty(JSON_PROPERTY_PRIVATE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + public GCPServiceAccount serviceAccountEmail(String serviceAccountEmail) { + this.serviceAccountEmail = serviceAccountEmail; + return this; + } + + /** + * The GCPServiceAccount service_account_email. + * + * @return serviceAccountEmail + */ + @JsonProperty(JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getServiceAccountEmail() { + return serviceAccountEmail; + } + + public void setServiceAccountEmail(String serviceAccountEmail) { + this.serviceAccountEmail = serviceAccountEmail; + } + + public GCPServiceAccount type(GCPServiceAccountCredentialType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GCPServiceAccount object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPServiceAccountCredentialType getType() { + return type; + } + + public void setType(GCPServiceAccountCredentialType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPServiceAccount + */ + @JsonAnySetter + public GCPServiceAccount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPServiceAccount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPServiceAccount gcpServiceAccount = (GCPServiceAccount) o; + return Objects.equals(this.privateKey, gcpServiceAccount.privateKey) + && Objects.equals(this.serviceAccountEmail, gcpServiceAccount.serviceAccountEmail) + && Objects.equals(this.type, gcpServiceAccount.type) + && Objects.equals(this.additionalProperties, gcpServiceAccount.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(privateKey, serviceAccountEmail, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPServiceAccount {\n"); + sb.append(" privateKey: ").append(toIndentedString(privateKey)).append("\n"); + sb.append(" serviceAccountEmail: ") + .append(toIndentedString(serviceAccountEmail)) + .append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountCredentialType.java b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountCredentialType.java new file mode 100644 index 00000000000..482e232f211 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountCredentialType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GCPServiceAccount object. */ +@JsonSerialize( + using = GCPServiceAccountCredentialType.GCPServiceAccountCredentialTypeSerializer.class) +public class GCPServiceAccountCredentialType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("GCPServiceAccount")); + + public static final GCPServiceAccountCredentialType GCPSERVICEACCOUNT = + new GCPServiceAccountCredentialType("GCPServiceAccount"); + + GCPServiceAccountCredentialType(String value) { + super(value, allowedValues); + } + + public static class GCPServiceAccountCredentialTypeSerializer + extends StdSerializer { + public GCPServiceAccountCredentialTypeSerializer(Class t) { + super(t); + } + + public GCPServiceAccountCredentialTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPServiceAccountCredentialType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPServiceAccountCredentialType fromValue(String value) { + return new GCPServiceAccountCredentialType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountUpdate.java new file mode 100644 index 00000000000..a2c4c4553e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountUpdate.java @@ -0,0 +1,207 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GCPServiceAccount object. */ +@JsonPropertyOrder({ + GCPServiceAccountUpdate.JSON_PROPERTY_PRIVATE_KEY, + GCPServiceAccountUpdate.JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL, + GCPServiceAccountUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPServiceAccountUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PRIVATE_KEY = "private_key"; + private String privateKey; + + public static final String JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL = "service_account_email"; + private String serviceAccountEmail; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPServiceAccountCredentialType type; + + public GCPServiceAccountUpdate() {} + + @JsonCreator + public GCPServiceAccountUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GCPServiceAccountCredentialType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPServiceAccountUpdate privateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * The GCPServiceAccountUpdate private_key. + * + * @return privateKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRIVATE_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + public GCPServiceAccountUpdate serviceAccountEmail(String serviceAccountEmail) { + this.serviceAccountEmail = serviceAccountEmail; + return this; + } + + /** + * The GCPServiceAccountUpdate service_account_email. + * + * @return serviceAccountEmail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE_ACCOUNT_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServiceAccountEmail() { + return serviceAccountEmail; + } + + public void setServiceAccountEmail(String serviceAccountEmail) { + this.serviceAccountEmail = serviceAccountEmail; + } + + public GCPServiceAccountUpdate type(GCPServiceAccountCredentialType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GCPServiceAccount object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPServiceAccountCredentialType getType() { + return type; + } + + public void setType(GCPServiceAccountCredentialType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPServiceAccountUpdate + */ + @JsonAnySetter + public GCPServiceAccountUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPServiceAccountUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPServiceAccountUpdate gcpServiceAccountUpdate = (GCPServiceAccountUpdate) o; + return Objects.equals(this.privateKey, gcpServiceAccountUpdate.privateKey) + && Objects.equals(this.serviceAccountEmail, gcpServiceAccountUpdate.serviceAccountEmail) + && Objects.equals(this.type, gcpServiceAccountUpdate.type) + && Objects.equals(this.additionalProperties, gcpServiceAccountUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(privateKey, serviceAccountEmail, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPServiceAccountUpdate {\n"); + sb.append(" privateKey: ").append(toIndentedString(privateKey)).append("\n"); + sb.append(" serviceAccountEmail: ") + .append(toIndentedString(serviceAccountEmail)) + .append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKey.java new file mode 100644 index 00000000000..53fbce40862 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GeminiAPIKey object. */ +@JsonPropertyOrder({GeminiAPIKey.JSON_PROPERTY_API_KEY, GeminiAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GeminiAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GeminiAPIKeyType type; + + public GeminiAPIKey() {} + + @JsonCreator + public GeminiAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GeminiAPIKeyType type) { + this.apiKey = apiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GeminiAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The GeminiAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public GeminiAPIKey type(GeminiAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GeminiAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GeminiAPIKeyType getType() { + return type; + } + + public void setType(GeminiAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GeminiAPIKey + */ + @JsonAnySetter + public GeminiAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GeminiAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GeminiAPIKey geminiApiKey = (GeminiAPIKey) o; + return Objects.equals(this.apiKey, geminiApiKey.apiKey) + && Objects.equals(this.type, geminiApiKey.type) + && Objects.equals(this.additionalProperties, geminiApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GeminiAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKeyType.java new file mode 100644 index 00000000000..b4103af1aaa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GeminiAPIKey object. */ +@JsonSerialize(using = GeminiAPIKeyType.GeminiAPIKeyTypeSerializer.class) +public class GeminiAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("GeminiAPIKey")); + + public static final GeminiAPIKeyType GEMINIAPIKEY = new GeminiAPIKeyType("GeminiAPIKey"); + + GeminiAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class GeminiAPIKeyTypeSerializer extends StdSerializer { + public GeminiAPIKeyTypeSerializer(Class t) { + super(t); + } + + public GeminiAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(GeminiAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GeminiAPIKeyType fromValue(String value) { + return new GeminiAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKeyUpdate.java new file mode 100644 index 00000000000..f5e519da532 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GeminiAPIKey object. */ +@JsonPropertyOrder({ + GeminiAPIKeyUpdate.JSON_PROPERTY_API_KEY, + GeminiAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GeminiAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GeminiAPIKeyType type; + + public GeminiAPIKeyUpdate() {} + + @JsonCreator + public GeminiAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GeminiAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GeminiAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The GeminiAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public GeminiAPIKeyUpdate type(GeminiAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GeminiAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GeminiAPIKeyType getType() { + return type; + } + + public void setType(GeminiAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GeminiAPIKeyUpdate + */ + @JsonAnySetter + public GeminiAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GeminiAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GeminiAPIKeyUpdate geminiApiKeyUpdate = (GeminiAPIKeyUpdate) o; + return Objects.equals(this.apiKey, geminiApiKeyUpdate.apiKey) + && Objects.equals(this.type, geminiApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, geminiApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GeminiAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiCredentials.java b/src/main/java/com/datadog/api/client/v2/model/GeminiCredentials.java new file mode 100644 index 00000000000..4b5d3034138 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GeminiCredentials.GeminiCredentialsDeserializer.class) +@JsonSerialize(using = GeminiCredentials.GeminiCredentialsSerializer.class) +public class GeminiCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GeminiCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GeminiCredentialsSerializer extends StdSerializer { + public GeminiCredentialsSerializer(Class t) { + super(t); + } + + public GeminiCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(GeminiCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GeminiCredentialsDeserializer extends StdDeserializer { + public GeminiCredentialsDeserializer() { + this(GeminiCredentials.class); + } + + public GeminiCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public GeminiCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GeminiAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GeminiAPIKey.class.equals(Integer.class) + || GeminiAPIKey.class.equals(Long.class) + || GeminiAPIKey.class.equals(Float.class) + || GeminiAPIKey.class.equals(Double.class) + || GeminiAPIKey.class.equals(Boolean.class) + || GeminiAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GeminiAPIKey.class.equals(Integer.class) || GeminiAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GeminiAPIKey.class.equals(Float.class) || GeminiAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GeminiAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GeminiAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GeminiAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GeminiAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GeminiAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GeminiAPIKey'", e); + } + + GeminiCredentials ret = new GeminiCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GeminiCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GeminiCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GeminiCredentials() { + super("oneOf", Boolean.FALSE); + } + + public GeminiCredentials(GeminiAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GeminiAPIKey", new GenericType() {}); + JSON.registerDescendants(GeminiCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GeminiCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GeminiAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GeminiAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GeminiAPIKey"); + } + + /** + * Get the actual instance, which can be the following: GeminiAPIKey + * + * @return The actual instance (GeminiAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GeminiAPIKey`. If the actual instance is not `GeminiAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `GeminiAPIKey` + * @throws ClassCastException if the instance is not `GeminiAPIKey` + */ + public GeminiAPIKey getGeminiAPIKey() throws ClassCastException { + return (GeminiAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GeminiCredentialsUpdate.java new file mode 100644 index 00000000000..dad5cdd386e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GeminiCredentialsUpdate.GeminiCredentialsUpdateDeserializer.class) +@JsonSerialize(using = GeminiCredentialsUpdate.GeminiCredentialsUpdateSerializer.class) +public class GeminiCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GeminiCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GeminiCredentialsUpdateSerializer + extends StdSerializer { + public GeminiCredentialsUpdateSerializer(Class t) { + super(t); + } + + public GeminiCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + GeminiCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GeminiCredentialsUpdateDeserializer + extends StdDeserializer { + public GeminiCredentialsUpdateDeserializer() { + this(GeminiCredentialsUpdate.class); + } + + public GeminiCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public GeminiCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GeminiAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GeminiAPIKeyUpdate.class.equals(Integer.class) + || GeminiAPIKeyUpdate.class.equals(Long.class) + || GeminiAPIKeyUpdate.class.equals(Float.class) + || GeminiAPIKeyUpdate.class.equals(Double.class) + || GeminiAPIKeyUpdate.class.equals(Boolean.class) + || GeminiAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GeminiAPIKeyUpdate.class.equals(Integer.class) + || GeminiAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GeminiAPIKeyUpdate.class.equals(Float.class) + || GeminiAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GeminiAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GeminiAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GeminiAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GeminiAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GeminiAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GeminiAPIKeyUpdate'", e); + } + + GeminiCredentialsUpdate ret = new GeminiCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GeminiCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GeminiCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GeminiCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public GeminiCredentialsUpdate(GeminiAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GeminiAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(GeminiCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GeminiCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GeminiAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GeminiAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GeminiAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: GeminiAPIKeyUpdate + * + * @return The actual instance (GeminiAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GeminiAPIKeyUpdate`. If the actual instance is not + * `GeminiAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GeminiAPIKeyUpdate` + * @throws ClassCastException if the instance is not `GeminiAPIKeyUpdate` + */ + public GeminiAPIKeyUpdate getGeminiAPIKeyUpdate() throws ClassCastException { + return (GeminiAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiIntegration.java b/src/main/java/com/datadog/api/client/v2/model/GeminiIntegration.java new file mode 100644 index 00000000000..96fc6fc27de --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GeminiIntegration object. */ +@JsonPropertyOrder({ + GeminiIntegration.JSON_PROPERTY_CREDENTIALS, + GeminiIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GeminiIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GeminiCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GeminiIntegrationType type; + + public GeminiIntegration() {} + + @JsonCreator + public GeminiIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + GeminiCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GeminiIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GeminiIntegration credentials(GeminiCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GeminiCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GeminiCredentials getCredentials() { + return credentials; + } + + public void setCredentials(GeminiCredentials credentials) { + this.credentials = credentials; + } + + public GeminiIntegration type(GeminiIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GeminiIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GeminiIntegrationType getType() { + return type; + } + + public void setType(GeminiIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GeminiIntegration + */ + @JsonAnySetter + public GeminiIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GeminiIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GeminiIntegration geminiIntegration = (GeminiIntegration) o; + return Objects.equals(this.credentials, geminiIntegration.credentials) + && Objects.equals(this.type, geminiIntegration.type) + && Objects.equals(this.additionalProperties, geminiIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GeminiIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/GeminiIntegrationType.java new file mode 100644 index 00000000000..a716cfb3fc4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GeminiIntegrationType object. */ +@JsonSerialize(using = GeminiIntegrationType.GeminiIntegrationTypeSerializer.class) +public class GeminiIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Gemini")); + + public static final GeminiIntegrationType GEMINI = new GeminiIntegrationType("Gemini"); + + GeminiIntegrationType(String value) { + super(value, allowedValues); + } + + public static class GeminiIntegrationTypeSerializer extends StdSerializer { + public GeminiIntegrationTypeSerializer(Class t) { + super(t); + } + + public GeminiIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GeminiIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GeminiIntegrationType fromValue(String value) { + return new GeminiIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GeminiIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GeminiIntegrationUpdate.java new file mode 100644 index 00000000000..6e7ac469640 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GeminiIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GeminiIntegrationUpdate object. */ +@JsonPropertyOrder({ + GeminiIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + GeminiIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GeminiIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GeminiCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GeminiIntegrationType type; + + public GeminiIntegrationUpdate() {} + + @JsonCreator + public GeminiIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GeminiIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GeminiIntegrationUpdate credentials(GeminiCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GeminiCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GeminiCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(GeminiCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public GeminiIntegrationUpdate type(GeminiIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GeminiIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GeminiIntegrationType getType() { + return type; + } + + public void setType(GeminiIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GeminiIntegrationUpdate + */ + @JsonAnySetter + public GeminiIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GeminiIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GeminiIntegrationUpdate geminiIntegrationUpdate = (GeminiIntegrationUpdate) o; + return Objects.equals(this.credentials, geminiIntegrationUpdate.credentials) + && Objects.equals(this.type, geminiIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, geminiIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GeminiIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKey.java new file mode 100644 index 00000000000..23039379ed7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GitlabAPIKey object. */ +@JsonPropertyOrder({GitlabAPIKey.JSON_PROPERTY_API_TOKEN, GitlabAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitlabAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GitlabAPIKeyType type; + + public GitlabAPIKey() {} + + @JsonCreator + public GitlabAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GitlabAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitlabAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The GitlabAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public GitlabAPIKey type(GitlabAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GitlabAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitlabAPIKeyType getType() { + return type; + } + + public void setType(GitlabAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GitlabAPIKey + */ + @JsonAnySetter + public GitlabAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GitlabAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitlabAPIKey gitlabApiKey = (GitlabAPIKey) o; + return Objects.equals(this.apiToken, gitlabApiKey.apiToken) + && Objects.equals(this.type, gitlabApiKey.type) + && Objects.equals(this.additionalProperties, gitlabApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitlabAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKeyType.java new file mode 100644 index 00000000000..798fa5abe1d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GitlabAPIKey object. */ +@JsonSerialize(using = GitlabAPIKeyType.GitlabAPIKeyTypeSerializer.class) +public class GitlabAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("GitlabAPIKey")); + + public static final GitlabAPIKeyType GITLABAPIKEY = new GitlabAPIKeyType("GitlabAPIKey"); + + GitlabAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class GitlabAPIKeyTypeSerializer extends StdSerializer { + public GitlabAPIKeyTypeSerializer(Class t) { + super(t); + } + + public GitlabAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(GitlabAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GitlabAPIKeyType fromValue(String value) { + return new GitlabAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKeyUpdate.java new file mode 100644 index 00000000000..fa3e6ed05e7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GitlabAPIKey object. */ +@JsonPropertyOrder({ + GitlabAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + GitlabAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitlabAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GitlabAPIKeyType type; + + public GitlabAPIKeyUpdate() {} + + @JsonCreator + public GitlabAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GitlabAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitlabAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The GitlabAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public GitlabAPIKeyUpdate type(GitlabAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GitlabAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitlabAPIKeyType getType() { + return type; + } + + public void setType(GitlabAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GitlabAPIKeyUpdate + */ + @JsonAnySetter + public GitlabAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GitlabAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitlabAPIKeyUpdate gitlabApiKeyUpdate = (GitlabAPIKeyUpdate) o; + return Objects.equals(this.apiToken, gitlabApiKeyUpdate.apiToken) + && Objects.equals(this.type, gitlabApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, gitlabApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitlabAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabCredentials.java b/src/main/java/com/datadog/api/client/v2/model/GitlabCredentials.java new file mode 100644 index 00000000000..91ed3a25689 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GitlabCredentials.GitlabCredentialsDeserializer.class) +@JsonSerialize(using = GitlabCredentials.GitlabCredentialsSerializer.class) +public class GitlabCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GitlabCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GitlabCredentialsSerializer extends StdSerializer { + public GitlabCredentialsSerializer(Class t) { + super(t); + } + + public GitlabCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(GitlabCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GitlabCredentialsDeserializer extends StdDeserializer { + public GitlabCredentialsDeserializer() { + this(GitlabCredentials.class); + } + + public GitlabCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public GitlabCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GitlabAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitlabAPIKey.class.equals(Integer.class) + || GitlabAPIKey.class.equals(Long.class) + || GitlabAPIKey.class.equals(Float.class) + || GitlabAPIKey.class.equals(Double.class) + || GitlabAPIKey.class.equals(Boolean.class) + || GitlabAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitlabAPIKey.class.equals(Integer.class) || GitlabAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitlabAPIKey.class.equals(Float.class) || GitlabAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitlabAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitlabAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GitlabAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitlabAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GitlabAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GitlabAPIKey'", e); + } + + GitlabCredentials ret = new GitlabCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GitlabCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GitlabCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GitlabCredentials() { + super("oneOf", Boolean.FALSE); + } + + public GitlabCredentials(GitlabAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GitlabAPIKey", new GenericType() {}); + JSON.registerDescendants(GitlabCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GitlabCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GitlabAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GitlabAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GitlabAPIKey"); + } + + /** + * Get the actual instance, which can be the following: GitlabAPIKey + * + * @return The actual instance (GitlabAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GitlabAPIKey`. If the actual instance is not `GitlabAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `GitlabAPIKey` + * @throws ClassCastException if the instance is not `GitlabAPIKey` + */ + public GitlabAPIKey getGitlabAPIKey() throws ClassCastException { + return (GitlabAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GitlabCredentialsUpdate.java new file mode 100644 index 00000000000..37dcd41e2b1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GitlabCredentialsUpdate.GitlabCredentialsUpdateDeserializer.class) +@JsonSerialize(using = GitlabCredentialsUpdate.GitlabCredentialsUpdateSerializer.class) +public class GitlabCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GitlabCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GitlabCredentialsUpdateSerializer + extends StdSerializer { + public GitlabCredentialsUpdateSerializer(Class t) { + super(t); + } + + public GitlabCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + GitlabCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GitlabCredentialsUpdateDeserializer + extends StdDeserializer { + public GitlabCredentialsUpdateDeserializer() { + this(GitlabCredentialsUpdate.class); + } + + public GitlabCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public GitlabCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GitlabAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitlabAPIKeyUpdate.class.equals(Integer.class) + || GitlabAPIKeyUpdate.class.equals(Long.class) + || GitlabAPIKeyUpdate.class.equals(Float.class) + || GitlabAPIKeyUpdate.class.equals(Double.class) + || GitlabAPIKeyUpdate.class.equals(Boolean.class) + || GitlabAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitlabAPIKeyUpdate.class.equals(Integer.class) + || GitlabAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitlabAPIKeyUpdate.class.equals(Float.class) + || GitlabAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitlabAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitlabAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GitlabAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitlabAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GitlabAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GitlabAPIKeyUpdate'", e); + } + + GitlabCredentialsUpdate ret = new GitlabCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GitlabCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GitlabCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GitlabCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public GitlabCredentialsUpdate(GitlabAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GitlabAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(GitlabCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GitlabCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GitlabAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GitlabAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GitlabAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: GitlabAPIKeyUpdate + * + * @return The actual instance (GitlabAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GitlabAPIKeyUpdate`. If the actual instance is not + * `GitlabAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GitlabAPIKeyUpdate` + * @throws ClassCastException if the instance is not `GitlabAPIKeyUpdate` + */ + public GitlabAPIKeyUpdate getGitlabAPIKeyUpdate() throws ClassCastException { + return (GitlabAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabIntegration.java b/src/main/java/com/datadog/api/client/v2/model/GitlabIntegration.java new file mode 100644 index 00000000000..1e756c0c1cc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GitlabIntegration object. */ +@JsonPropertyOrder({ + GitlabIntegration.JSON_PROPERTY_CREDENTIALS, + GitlabIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitlabIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GitlabCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GitlabIntegrationType type; + + public GitlabIntegration() {} + + @JsonCreator + public GitlabIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + GitlabCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GitlabIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitlabIntegration credentials(GitlabCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GitlabCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitlabCredentials getCredentials() { + return credentials; + } + + public void setCredentials(GitlabCredentials credentials) { + this.credentials = credentials; + } + + public GitlabIntegration type(GitlabIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GitlabIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitlabIntegrationType getType() { + return type; + } + + public void setType(GitlabIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GitlabIntegration + */ + @JsonAnySetter + public GitlabIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GitlabIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitlabIntegration gitlabIntegration = (GitlabIntegration) o; + return Objects.equals(this.credentials, gitlabIntegration.credentials) + && Objects.equals(this.type, gitlabIntegration.type) + && Objects.equals(this.additionalProperties, gitlabIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitlabIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/GitlabIntegrationType.java new file mode 100644 index 00000000000..d74f9d74b10 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GitlabIntegrationType object. */ +@JsonSerialize(using = GitlabIntegrationType.GitlabIntegrationTypeSerializer.class) +public class GitlabIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Gitlab")); + + public static final GitlabIntegrationType GITLAB = new GitlabIntegrationType("Gitlab"); + + GitlabIntegrationType(String value) { + super(value, allowedValues); + } + + public static class GitlabIntegrationTypeSerializer extends StdSerializer { + public GitlabIntegrationTypeSerializer(Class t) { + super(t); + } + + public GitlabIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GitlabIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GitlabIntegrationType fromValue(String value) { + return new GitlabIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitlabIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GitlabIntegrationUpdate.java new file mode 100644 index 00000000000..fd0ab8ca88f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitlabIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GitlabIntegrationUpdate object. */ +@JsonPropertyOrder({ + GitlabIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + GitlabIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitlabIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GitlabCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GitlabIntegrationType type; + + public GitlabIntegrationUpdate() {} + + @JsonCreator + public GitlabIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GitlabIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitlabIntegrationUpdate credentials(GitlabCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GitlabCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GitlabCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(GitlabCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public GitlabIntegrationUpdate type(GitlabIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GitlabIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitlabIntegrationType getType() { + return type; + } + + public void setType(GitlabIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GitlabIntegrationUpdate + */ + @JsonAnySetter + public GitlabIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GitlabIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitlabIntegrationUpdate gitlabIntegrationUpdate = (GitlabIntegrationUpdate) o; + return Objects.equals(this.credentials, gitlabIntegrationUpdate.credentials) + && Objects.equals(this.type, gitlabIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, gitlabIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitlabIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKey.java new file mode 100644 index 00000000000..6c9b2447aff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GreyNoiseAPIKey object. */ +@JsonPropertyOrder({GreyNoiseAPIKey.JSON_PROPERTY_API_KEY, GreyNoiseAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GreyNoiseAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GreyNoiseAPIKeyType type; + + public GreyNoiseAPIKey() {} + + @JsonCreator + public GreyNoiseAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GreyNoiseAPIKeyType type) { + this.apiKey = apiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GreyNoiseAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The GreyNoiseAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public GreyNoiseAPIKey type(GreyNoiseAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GreyNoiseAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GreyNoiseAPIKeyType getType() { + return type; + } + + public void setType(GreyNoiseAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GreyNoiseAPIKey + */ + @JsonAnySetter + public GreyNoiseAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GreyNoiseAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GreyNoiseAPIKey greyNoiseApiKey = (GreyNoiseAPIKey) o; + return Objects.equals(this.apiKey, greyNoiseApiKey.apiKey) + && Objects.equals(this.type, greyNoiseApiKey.type) + && Objects.equals(this.additionalProperties, greyNoiseApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GreyNoiseAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKeyType.java new file mode 100644 index 00000000000..988f669a562 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKeyType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GreyNoiseAPIKey object. */ +@JsonSerialize(using = GreyNoiseAPIKeyType.GreyNoiseAPIKeyTypeSerializer.class) +public class GreyNoiseAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("GreyNoiseAPIKey")); + + public static final GreyNoiseAPIKeyType GREYNOISEAPIKEY = + new GreyNoiseAPIKeyType("GreyNoiseAPIKey"); + + GreyNoiseAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class GreyNoiseAPIKeyTypeSerializer extends StdSerializer { + public GreyNoiseAPIKeyTypeSerializer(Class t) { + super(t); + } + + public GreyNoiseAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GreyNoiseAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GreyNoiseAPIKeyType fromValue(String value) { + return new GreyNoiseAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKeyUpdate.java new file mode 100644 index 00000000000..0c85c8c2a39 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GreyNoiseAPIKey object. */ +@JsonPropertyOrder({ + GreyNoiseAPIKeyUpdate.JSON_PROPERTY_API_KEY, + GreyNoiseAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GreyNoiseAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GreyNoiseAPIKeyType type; + + public GreyNoiseAPIKeyUpdate() {} + + @JsonCreator + public GreyNoiseAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GreyNoiseAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GreyNoiseAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The GreyNoiseAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public GreyNoiseAPIKeyUpdate type(GreyNoiseAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GreyNoiseAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GreyNoiseAPIKeyType getType() { + return type; + } + + public void setType(GreyNoiseAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GreyNoiseAPIKeyUpdate + */ + @JsonAnySetter + public GreyNoiseAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GreyNoiseAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GreyNoiseAPIKeyUpdate greyNoiseApiKeyUpdate = (GreyNoiseAPIKeyUpdate) o; + return Objects.equals(this.apiKey, greyNoiseApiKeyUpdate.apiKey) + && Objects.equals(this.type, greyNoiseApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, greyNoiseApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GreyNoiseAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseCredentials.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseCredentials.java new file mode 100644 index 00000000000..6d35c232417 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseCredentials.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GreyNoiseCredentials.GreyNoiseCredentialsDeserializer.class) +@JsonSerialize(using = GreyNoiseCredentials.GreyNoiseCredentialsSerializer.class) +public class GreyNoiseCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GreyNoiseCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GreyNoiseCredentialsSerializer extends StdSerializer { + public GreyNoiseCredentialsSerializer(Class t) { + super(t); + } + + public GreyNoiseCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + GreyNoiseCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GreyNoiseCredentialsDeserializer + extends StdDeserializer { + public GreyNoiseCredentialsDeserializer() { + this(GreyNoiseCredentials.class); + } + + public GreyNoiseCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public GreyNoiseCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GreyNoiseAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GreyNoiseAPIKey.class.equals(Integer.class) + || GreyNoiseAPIKey.class.equals(Long.class) + || GreyNoiseAPIKey.class.equals(Float.class) + || GreyNoiseAPIKey.class.equals(Double.class) + || GreyNoiseAPIKey.class.equals(Boolean.class) + || GreyNoiseAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GreyNoiseAPIKey.class.equals(Integer.class) + || GreyNoiseAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GreyNoiseAPIKey.class.equals(Float.class) + || GreyNoiseAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GreyNoiseAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GreyNoiseAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GreyNoiseAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GreyNoiseAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GreyNoiseAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GreyNoiseAPIKey'", e); + } + + GreyNoiseCredentials ret = new GreyNoiseCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GreyNoiseCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GreyNoiseCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GreyNoiseCredentials() { + super("oneOf", Boolean.FALSE); + } + + public GreyNoiseCredentials(GreyNoiseAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GreyNoiseAPIKey", new GenericType() {}); + JSON.registerDescendants(GreyNoiseCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GreyNoiseCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GreyNoiseAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GreyNoiseAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GreyNoiseAPIKey"); + } + + /** + * Get the actual instance, which can be the following: GreyNoiseAPIKey + * + * @return The actual instance (GreyNoiseAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GreyNoiseAPIKey`. If the actual instance is not `GreyNoiseAPIKey`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GreyNoiseAPIKey` + * @throws ClassCastException if the instance is not `GreyNoiseAPIKey` + */ + public GreyNoiseAPIKey getGreyNoiseAPIKey() throws ClassCastException { + return (GreyNoiseAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseCredentialsUpdate.java new file mode 100644 index 00000000000..7271ab8f542 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseCredentialsUpdate.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GreyNoiseCredentialsUpdate.GreyNoiseCredentialsUpdateDeserializer.class) +@JsonSerialize(using = GreyNoiseCredentialsUpdate.GreyNoiseCredentialsUpdateSerializer.class) +public class GreyNoiseCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GreyNoiseCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GreyNoiseCredentialsUpdateSerializer + extends StdSerializer { + public GreyNoiseCredentialsUpdateSerializer(Class t) { + super(t); + } + + public GreyNoiseCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + GreyNoiseCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GreyNoiseCredentialsUpdateDeserializer + extends StdDeserializer { + public GreyNoiseCredentialsUpdateDeserializer() { + this(GreyNoiseCredentialsUpdate.class); + } + + public GreyNoiseCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public GreyNoiseCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GreyNoiseAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GreyNoiseAPIKeyUpdate.class.equals(Integer.class) + || GreyNoiseAPIKeyUpdate.class.equals(Long.class) + || GreyNoiseAPIKeyUpdate.class.equals(Float.class) + || GreyNoiseAPIKeyUpdate.class.equals(Double.class) + || GreyNoiseAPIKeyUpdate.class.equals(Boolean.class) + || GreyNoiseAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GreyNoiseAPIKeyUpdate.class.equals(Integer.class) + || GreyNoiseAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GreyNoiseAPIKeyUpdate.class.equals(Float.class) + || GreyNoiseAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GreyNoiseAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GreyNoiseAPIKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GreyNoiseAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GreyNoiseAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GreyNoiseAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GreyNoiseAPIKeyUpdate'", e); + } + + GreyNoiseCredentialsUpdate ret = new GreyNoiseCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GreyNoiseCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GreyNoiseCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GreyNoiseCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public GreyNoiseCredentialsUpdate(GreyNoiseAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GreyNoiseAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants( + GreyNoiseCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GreyNoiseCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GreyNoiseAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GreyNoiseAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be GreyNoiseAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: GreyNoiseAPIKeyUpdate + * + * @return The actual instance (GreyNoiseAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GreyNoiseAPIKeyUpdate`. If the actual instance is not + * `GreyNoiseAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `GreyNoiseAPIKeyUpdate` + * @throws ClassCastException if the instance is not `GreyNoiseAPIKeyUpdate` + */ + public GreyNoiseAPIKeyUpdate getGreyNoiseAPIKeyUpdate() throws ClassCastException { + return (GreyNoiseAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegration.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegration.java new file mode 100644 index 00000000000..e44dc92a2f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GreyNoiseIntegration object. */ +@JsonPropertyOrder({ + GreyNoiseIntegration.JSON_PROPERTY_CREDENTIALS, + GreyNoiseIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GreyNoiseIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GreyNoiseCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GreyNoiseIntegrationType type; + + public GreyNoiseIntegration() {} + + @JsonCreator + public GreyNoiseIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + GreyNoiseCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GreyNoiseIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GreyNoiseIntegration credentials(GreyNoiseCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GreyNoiseCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GreyNoiseCredentials getCredentials() { + return credentials; + } + + public void setCredentials(GreyNoiseCredentials credentials) { + this.credentials = credentials; + } + + public GreyNoiseIntegration type(GreyNoiseIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GreyNoiseIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GreyNoiseIntegrationType getType() { + return type; + } + + public void setType(GreyNoiseIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GreyNoiseIntegration + */ + @JsonAnySetter + public GreyNoiseIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GreyNoiseIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GreyNoiseIntegration greyNoiseIntegration = (GreyNoiseIntegration) o; + return Objects.equals(this.credentials, greyNoiseIntegration.credentials) + && Objects.equals(this.type, greyNoiseIntegration.type) + && Objects.equals(this.additionalProperties, greyNoiseIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GreyNoiseIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegrationType.java new file mode 100644 index 00000000000..260c542ebea --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegrationType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the GreyNoiseIntegrationType object. */ +@JsonSerialize(using = GreyNoiseIntegrationType.GreyNoiseIntegrationTypeSerializer.class) +public class GreyNoiseIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("GreyNoise")); + + public static final GreyNoiseIntegrationType GREYNOISE = + new GreyNoiseIntegrationType("GreyNoise"); + + GreyNoiseIntegrationType(String value) { + super(value, allowedValues); + } + + public static class GreyNoiseIntegrationTypeSerializer + extends StdSerializer { + public GreyNoiseIntegrationTypeSerializer(Class t) { + super(t); + } + + public GreyNoiseIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GreyNoiseIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GreyNoiseIntegrationType fromValue(String value) { + return new GreyNoiseIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegrationUpdate.java new file mode 100644 index 00000000000..daafad9eef2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GreyNoiseIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the GreyNoiseIntegrationUpdate object. */ +@JsonPropertyOrder({ + GreyNoiseIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + GreyNoiseIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GreyNoiseIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private GreyNoiseCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GreyNoiseIntegrationType type; + + public GreyNoiseIntegrationUpdate() {} + + @JsonCreator + public GreyNoiseIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GreyNoiseIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GreyNoiseIntegrationUpdate credentials(GreyNoiseCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the GreyNoiseCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GreyNoiseCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(GreyNoiseCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public GreyNoiseIntegrationUpdate type(GreyNoiseIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the GreyNoiseIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GreyNoiseIntegrationType getType() { + return type; + } + + public void setType(GreyNoiseIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GreyNoiseIntegrationUpdate + */ + @JsonAnySetter + public GreyNoiseIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GreyNoiseIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GreyNoiseIntegrationUpdate greyNoiseIntegrationUpdate = (GreyNoiseIntegrationUpdate) o; + return Objects.equals(this.credentials, greyNoiseIntegrationUpdate.credentials) + && Objects.equals(this.type, greyNoiseIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, greyNoiseIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GreyNoiseIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKey.java new file mode 100644 index 00000000000..22bd38f3a72 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKey.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the LaunchDarklyAPIKey object. */ +@JsonPropertyOrder({ + LaunchDarklyAPIKey.JSON_PROPERTY_API_TOKEN, + LaunchDarklyAPIKey.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LaunchDarklyAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LaunchDarklyAPIKeyType type; + + public LaunchDarklyAPIKey() {} + + @JsonCreator + public LaunchDarklyAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LaunchDarklyAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LaunchDarklyAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The LaunchDarklyAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public LaunchDarklyAPIKey type(LaunchDarklyAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the LaunchDarklyAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LaunchDarklyAPIKeyType getType() { + return type; + } + + public void setType(LaunchDarklyAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LaunchDarklyAPIKey + */ + @JsonAnySetter + public LaunchDarklyAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LaunchDarklyAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LaunchDarklyAPIKey launchDarklyApiKey = (LaunchDarklyAPIKey) o; + return Objects.equals(this.apiToken, launchDarklyApiKey.apiToken) + && Objects.equals(this.type, launchDarklyApiKey.type) + && Objects.equals(this.additionalProperties, launchDarklyApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LaunchDarklyAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKeyType.java new file mode 100644 index 00000000000..63a73d8f7b7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKeyType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the LaunchDarklyAPIKey object. */ +@JsonSerialize(using = LaunchDarklyAPIKeyType.LaunchDarklyAPIKeyTypeSerializer.class) +public class LaunchDarklyAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("LaunchDarklyAPIKey")); + + public static final LaunchDarklyAPIKeyType LAUNCHDARKLYAPIKEY = + new LaunchDarklyAPIKeyType("LaunchDarklyAPIKey"); + + LaunchDarklyAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class LaunchDarklyAPIKeyTypeSerializer + extends StdSerializer { + public LaunchDarklyAPIKeyTypeSerializer(Class t) { + super(t); + } + + public LaunchDarklyAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LaunchDarklyAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LaunchDarklyAPIKeyType fromValue(String value) { + return new LaunchDarklyAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKeyUpdate.java new file mode 100644 index 00000000000..4832b74f5ee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the LaunchDarklyAPIKey object. */ +@JsonPropertyOrder({ + LaunchDarklyAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + LaunchDarklyAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LaunchDarklyAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LaunchDarklyAPIKeyType type; + + public LaunchDarklyAPIKeyUpdate() {} + + @JsonCreator + public LaunchDarklyAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LaunchDarklyAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LaunchDarklyAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The LaunchDarklyAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public LaunchDarklyAPIKeyUpdate type(LaunchDarklyAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the LaunchDarklyAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LaunchDarklyAPIKeyType getType() { + return type; + } + + public void setType(LaunchDarklyAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LaunchDarklyAPIKeyUpdate + */ + @JsonAnySetter + public LaunchDarklyAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LaunchDarklyAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LaunchDarklyAPIKeyUpdate launchDarklyApiKeyUpdate = (LaunchDarklyAPIKeyUpdate) o; + return Objects.equals(this.apiToken, launchDarklyApiKeyUpdate.apiToken) + && Objects.equals(this.type, launchDarklyApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, launchDarklyApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LaunchDarklyAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyCredentials.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyCredentials.java new file mode 100644 index 00000000000..dc7cda391c2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyCredentials.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = LaunchDarklyCredentials.LaunchDarklyCredentialsDeserializer.class) +@JsonSerialize(using = LaunchDarklyCredentials.LaunchDarklyCredentialsSerializer.class) +public class LaunchDarklyCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(LaunchDarklyCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class LaunchDarklyCredentialsSerializer + extends StdSerializer { + public LaunchDarklyCredentialsSerializer(Class t) { + super(t); + } + + public LaunchDarklyCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + LaunchDarklyCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class LaunchDarklyCredentialsDeserializer + extends StdDeserializer { + public LaunchDarklyCredentialsDeserializer() { + this(LaunchDarklyCredentials.class); + } + + public LaunchDarklyCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public LaunchDarklyCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LaunchDarklyAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LaunchDarklyAPIKey.class.equals(Integer.class) + || LaunchDarklyAPIKey.class.equals(Long.class) + || LaunchDarklyAPIKey.class.equals(Float.class) + || LaunchDarklyAPIKey.class.equals(Double.class) + || LaunchDarklyAPIKey.class.equals(Boolean.class) + || LaunchDarklyAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LaunchDarklyAPIKey.class.equals(Integer.class) + || LaunchDarklyAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LaunchDarklyAPIKey.class.equals(Float.class) + || LaunchDarklyAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LaunchDarklyAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LaunchDarklyAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LaunchDarklyAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LaunchDarklyAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LaunchDarklyAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LaunchDarklyAPIKey'", e); + } + + LaunchDarklyCredentials ret = new LaunchDarklyCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public LaunchDarklyCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "LaunchDarklyCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LaunchDarklyCredentials() { + super("oneOf", Boolean.FALSE); + } + + public LaunchDarklyCredentials(LaunchDarklyAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("LaunchDarklyAPIKey", new GenericType() {}); + JSON.registerDescendants(LaunchDarklyCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return LaunchDarklyCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LaunchDarklyAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(LaunchDarklyAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be LaunchDarklyAPIKey"); + } + + /** + * Get the actual instance, which can be the following: LaunchDarklyAPIKey + * + * @return The actual instance (LaunchDarklyAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `LaunchDarklyAPIKey`. If the actual instance is not + * `LaunchDarklyAPIKey`, the ClassCastException will be thrown. + * + * @return The actual instance of `LaunchDarklyAPIKey` + * @throws ClassCastException if the instance is not `LaunchDarklyAPIKey` + */ + public LaunchDarklyAPIKey getLaunchDarklyAPIKey() throws ClassCastException { + return (LaunchDarklyAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyCredentialsUpdate.java new file mode 100644 index 00000000000..c254fc399d7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyCredentialsUpdate.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = LaunchDarklyCredentialsUpdate.LaunchDarklyCredentialsUpdateDeserializer.class) +@JsonSerialize(using = LaunchDarklyCredentialsUpdate.LaunchDarklyCredentialsUpdateSerializer.class) +public class LaunchDarklyCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(LaunchDarklyCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class LaunchDarklyCredentialsUpdateSerializer + extends StdSerializer { + public LaunchDarklyCredentialsUpdateSerializer(Class t) { + super(t); + } + + public LaunchDarklyCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + LaunchDarklyCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class LaunchDarklyCredentialsUpdateDeserializer + extends StdDeserializer { + public LaunchDarklyCredentialsUpdateDeserializer() { + this(LaunchDarklyCredentialsUpdate.class); + } + + public LaunchDarklyCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public LaunchDarklyCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LaunchDarklyAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LaunchDarklyAPIKeyUpdate.class.equals(Integer.class) + || LaunchDarklyAPIKeyUpdate.class.equals(Long.class) + || LaunchDarklyAPIKeyUpdate.class.equals(Float.class) + || LaunchDarklyAPIKeyUpdate.class.equals(Double.class) + || LaunchDarklyAPIKeyUpdate.class.equals(Boolean.class) + || LaunchDarklyAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LaunchDarklyAPIKeyUpdate.class.equals(Integer.class) + || LaunchDarklyAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LaunchDarklyAPIKeyUpdate.class.equals(Float.class) + || LaunchDarklyAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LaunchDarklyAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LaunchDarklyAPIKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LaunchDarklyAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LaunchDarklyAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LaunchDarklyAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LaunchDarklyAPIKeyUpdate'", e); + } + + LaunchDarklyCredentialsUpdate ret = new LaunchDarklyCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public LaunchDarklyCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "LaunchDarklyCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LaunchDarklyCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public LaunchDarklyCredentialsUpdate(LaunchDarklyAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("LaunchDarklyAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants( + LaunchDarklyCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return LaunchDarklyCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LaunchDarklyAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(LaunchDarklyAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be LaunchDarklyAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: LaunchDarklyAPIKeyUpdate + * + * @return The actual instance (LaunchDarklyAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `LaunchDarklyAPIKeyUpdate`. If the actual instance is not + * `LaunchDarklyAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `LaunchDarklyAPIKeyUpdate` + * @throws ClassCastException if the instance is not `LaunchDarklyAPIKeyUpdate` + */ + public LaunchDarklyAPIKeyUpdate getLaunchDarklyAPIKeyUpdate() throws ClassCastException { + return (LaunchDarklyAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegration.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegration.java new file mode 100644 index 00000000000..cf98a2a0364 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the LaunchDarklyIntegration object. */ +@JsonPropertyOrder({ + LaunchDarklyIntegration.JSON_PROPERTY_CREDENTIALS, + LaunchDarklyIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LaunchDarklyIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private LaunchDarklyCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LaunchDarklyIntegrationType type; + + public LaunchDarklyIntegration() {} + + @JsonCreator + public LaunchDarklyIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + LaunchDarklyCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LaunchDarklyIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LaunchDarklyIntegration credentials(LaunchDarklyCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the LaunchDarklyCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LaunchDarklyCredentials getCredentials() { + return credentials; + } + + public void setCredentials(LaunchDarklyCredentials credentials) { + this.credentials = credentials; + } + + public LaunchDarklyIntegration type(LaunchDarklyIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the LaunchDarklyIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LaunchDarklyIntegrationType getType() { + return type; + } + + public void setType(LaunchDarklyIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LaunchDarklyIntegration + */ + @JsonAnySetter + public LaunchDarklyIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LaunchDarklyIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LaunchDarklyIntegration launchDarklyIntegration = (LaunchDarklyIntegration) o; + return Objects.equals(this.credentials, launchDarklyIntegration.credentials) + && Objects.equals(this.type, launchDarklyIntegration.type) + && Objects.equals(this.additionalProperties, launchDarklyIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LaunchDarklyIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegrationType.java new file mode 100644 index 00000000000..2071836991d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegrationType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the LaunchDarklyIntegrationType object. */ +@JsonSerialize(using = LaunchDarklyIntegrationType.LaunchDarklyIntegrationTypeSerializer.class) +public class LaunchDarklyIntegrationType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("LaunchDarkly")); + + public static final LaunchDarklyIntegrationType LAUNCHDARKLY = + new LaunchDarklyIntegrationType("LaunchDarkly"); + + LaunchDarklyIntegrationType(String value) { + super(value, allowedValues); + } + + public static class LaunchDarklyIntegrationTypeSerializer + extends StdSerializer { + public LaunchDarklyIntegrationTypeSerializer(Class t) { + super(t); + } + + public LaunchDarklyIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LaunchDarklyIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LaunchDarklyIntegrationType fromValue(String value) { + return new LaunchDarklyIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegrationUpdate.java new file mode 100644 index 00000000000..9ec478d5f45 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LaunchDarklyIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the LaunchDarklyIntegrationUpdate object. */ +@JsonPropertyOrder({ + LaunchDarklyIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + LaunchDarklyIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LaunchDarklyIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private LaunchDarklyCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LaunchDarklyIntegrationType type; + + public LaunchDarklyIntegrationUpdate() {} + + @JsonCreator + public LaunchDarklyIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LaunchDarklyIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LaunchDarklyIntegrationUpdate credentials(LaunchDarklyCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the LaunchDarklyCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LaunchDarklyCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(LaunchDarklyCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public LaunchDarklyIntegrationUpdate type(LaunchDarklyIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the LaunchDarklyIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LaunchDarklyIntegrationType getType() { + return type; + } + + public void setType(LaunchDarklyIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LaunchDarklyIntegrationUpdate + */ + @JsonAnySetter + public LaunchDarklyIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LaunchDarklyIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LaunchDarklyIntegrationUpdate launchDarklyIntegrationUpdate = (LaunchDarklyIntegrationUpdate) o; + return Objects.equals(this.credentials, launchDarklyIntegrationUpdate.credentials) + && Objects.equals(this.type, launchDarklyIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, launchDarklyIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LaunchDarklyIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/NotionAPIKey.java new file mode 100644 index 00000000000..bd99a700773 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the NotionAPIKey object. */ +@JsonPropertyOrder({NotionAPIKey.JSON_PROPERTY_API_TOKEN, NotionAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NotionAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NotionAPIKeyType type; + + public NotionAPIKey() {} + + @JsonCreator + public NotionAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) NotionAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public NotionAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The NotionAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public NotionAPIKey type(NotionAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the NotionAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NotionAPIKeyType getType() { + return type; + } + + public void setType(NotionAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return NotionAPIKey + */ + @JsonAnySetter + public NotionAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this NotionAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NotionAPIKey notionApiKey = (NotionAPIKey) o; + return Objects.equals(this.apiToken, notionApiKey.apiToken) + && Objects.equals(this.type, notionApiKey.type) + && Objects.equals(this.additionalProperties, notionApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotionAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/NotionAPIKeyType.java new file mode 100644 index 00000000000..71c5fad2222 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the NotionAPIKey object. */ +@JsonSerialize(using = NotionAPIKeyType.NotionAPIKeyTypeSerializer.class) +public class NotionAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("NotionAPIKey")); + + public static final NotionAPIKeyType NOTIONAPIKEY = new NotionAPIKeyType("NotionAPIKey"); + + NotionAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class NotionAPIKeyTypeSerializer extends StdSerializer { + public NotionAPIKeyTypeSerializer(Class t) { + super(t); + } + + public NotionAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(NotionAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static NotionAPIKeyType fromValue(String value) { + return new NotionAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/NotionAPIKeyUpdate.java new file mode 100644 index 00000000000..d930cff5199 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the NotionAPIKey object. */ +@JsonPropertyOrder({ + NotionAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + NotionAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NotionAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NotionAPIKeyType type; + + public NotionAPIKeyUpdate() {} + + @JsonCreator + public NotionAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) NotionAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public NotionAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The NotionAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public NotionAPIKeyUpdate type(NotionAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the NotionAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NotionAPIKeyType getType() { + return type; + } + + public void setType(NotionAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return NotionAPIKeyUpdate + */ + @JsonAnySetter + public NotionAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this NotionAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NotionAPIKeyUpdate notionApiKeyUpdate = (NotionAPIKeyUpdate) o; + return Objects.equals(this.apiToken, notionApiKeyUpdate.apiToken) + && Objects.equals(this.type, notionApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, notionApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotionAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionCredentials.java b/src/main/java/com/datadog/api/client/v2/model/NotionCredentials.java new file mode 100644 index 00000000000..d304fcb7774 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = NotionCredentials.NotionCredentialsDeserializer.class) +@JsonSerialize(using = NotionCredentials.NotionCredentialsSerializer.class) +public class NotionCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NotionCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class NotionCredentialsSerializer extends StdSerializer { + public NotionCredentialsSerializer(Class t) { + super(t); + } + + public NotionCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(NotionCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class NotionCredentialsDeserializer extends StdDeserializer { + public NotionCredentialsDeserializer() { + this(NotionCredentials.class); + } + + public NotionCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public NotionCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize NotionAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (NotionAPIKey.class.equals(Integer.class) + || NotionAPIKey.class.equals(Long.class) + || NotionAPIKey.class.equals(Float.class) + || NotionAPIKey.class.equals(Double.class) + || NotionAPIKey.class.equals(Boolean.class) + || NotionAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((NotionAPIKey.class.equals(Integer.class) || NotionAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((NotionAPIKey.class.equals(Float.class) || NotionAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (NotionAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (NotionAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(NotionAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((NotionAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'NotionAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NotionAPIKey'", e); + } + + NotionCredentials ret = new NotionCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public NotionCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "NotionCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public NotionCredentials() { + super("oneOf", Boolean.FALSE); + } + + public NotionCredentials(NotionAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NotionAPIKey", new GenericType() {}); + JSON.registerDescendants(NotionCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return NotionCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: NotionAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(NotionAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be NotionAPIKey"); + } + + /** + * Get the actual instance, which can be the following: NotionAPIKey + * + * @return The actual instance (NotionAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NotionAPIKey`. If the actual instance is not `NotionAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `NotionAPIKey` + * @throws ClassCastException if the instance is not `NotionAPIKey` + */ + public NotionAPIKey getNotionAPIKey() throws ClassCastException { + return (NotionAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/NotionCredentialsUpdate.java new file mode 100644 index 00000000000..a5d84531293 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = NotionCredentialsUpdate.NotionCredentialsUpdateDeserializer.class) +@JsonSerialize(using = NotionCredentialsUpdate.NotionCredentialsUpdateSerializer.class) +public class NotionCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NotionCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class NotionCredentialsUpdateSerializer + extends StdSerializer { + public NotionCredentialsUpdateSerializer(Class t) { + super(t); + } + + public NotionCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + NotionCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class NotionCredentialsUpdateDeserializer + extends StdDeserializer { + public NotionCredentialsUpdateDeserializer() { + this(NotionCredentialsUpdate.class); + } + + public NotionCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public NotionCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize NotionAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (NotionAPIKeyUpdate.class.equals(Integer.class) + || NotionAPIKeyUpdate.class.equals(Long.class) + || NotionAPIKeyUpdate.class.equals(Float.class) + || NotionAPIKeyUpdate.class.equals(Double.class) + || NotionAPIKeyUpdate.class.equals(Boolean.class) + || NotionAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((NotionAPIKeyUpdate.class.equals(Integer.class) + || NotionAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((NotionAPIKeyUpdate.class.equals(Float.class) + || NotionAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (NotionAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (NotionAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(NotionAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((NotionAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'NotionAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NotionAPIKeyUpdate'", e); + } + + NotionCredentialsUpdate ret = new NotionCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public NotionCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "NotionCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public NotionCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public NotionCredentialsUpdate(NotionAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NotionAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(NotionCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return NotionCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: NotionAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(NotionAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be NotionAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: NotionAPIKeyUpdate + * + * @return The actual instance (NotionAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NotionAPIKeyUpdate`. If the actual instance is not + * `NotionAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `NotionAPIKeyUpdate` + * @throws ClassCastException if the instance is not `NotionAPIKeyUpdate` + */ + public NotionAPIKeyUpdate getNotionAPIKeyUpdate() throws ClassCastException { + return (NotionAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionIntegration.java b/src/main/java/com/datadog/api/client/v2/model/NotionIntegration.java new file mode 100644 index 00000000000..c09282308df --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the NotionIntegration object. */ +@JsonPropertyOrder({ + NotionIntegration.JSON_PROPERTY_CREDENTIALS, + NotionIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NotionIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private NotionCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NotionIntegrationType type; + + public NotionIntegration() {} + + @JsonCreator + public NotionIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + NotionCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) NotionIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public NotionIntegration credentials(NotionCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the NotionCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NotionCredentials getCredentials() { + return credentials; + } + + public void setCredentials(NotionCredentials credentials) { + this.credentials = credentials; + } + + public NotionIntegration type(NotionIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the NotionIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NotionIntegrationType getType() { + return type; + } + + public void setType(NotionIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return NotionIntegration + */ + @JsonAnySetter + public NotionIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this NotionIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NotionIntegration notionIntegration = (NotionIntegration) o; + return Objects.equals(this.credentials, notionIntegration.credentials) + && Objects.equals(this.type, notionIntegration.type) + && Objects.equals(this.additionalProperties, notionIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotionIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/NotionIntegrationType.java new file mode 100644 index 00000000000..9f5a2222ab4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the NotionIntegrationType object. */ +@JsonSerialize(using = NotionIntegrationType.NotionIntegrationTypeSerializer.class) +public class NotionIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Notion")); + + public static final NotionIntegrationType NOTION = new NotionIntegrationType("Notion"); + + NotionIntegrationType(String value) { + super(value, allowedValues); + } + + public static class NotionIntegrationTypeSerializer extends StdSerializer { + public NotionIntegrationTypeSerializer(Class t) { + super(t); + } + + public NotionIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + NotionIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static NotionIntegrationType fromValue(String value) { + return new NotionIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NotionIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/NotionIntegrationUpdate.java new file mode 100644 index 00000000000..bb04747ff07 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NotionIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the NotionIntegrationUpdate object. */ +@JsonPropertyOrder({ + NotionIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + NotionIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NotionIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private NotionCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NotionIntegrationType type; + + public NotionIntegrationUpdate() {} + + @JsonCreator + public NotionIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) NotionIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public NotionIntegrationUpdate credentials(NotionCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the NotionCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NotionCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(NotionCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public NotionIntegrationUpdate type(NotionIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the NotionIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NotionIntegrationType getType() { + return type; + } + + public void setType(NotionIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return NotionIntegrationUpdate + */ + @JsonAnySetter + public NotionIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this NotionIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NotionIntegrationUpdate notionIntegrationUpdate = (NotionIntegrationUpdate) o; + return Objects.equals(this.credentials, notionIntegrationUpdate.credentials) + && Objects.equals(this.type, notionIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, notionIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotionIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaAPIToken.java b/src/main/java/com/datadog/api/client/v2/model/OktaAPIToken.java new file mode 100644 index 00000000000..5e1dba16292 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaAPIToken.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OktaAPIToken object. */ +@JsonPropertyOrder({ + OktaAPIToken.JSON_PROPERTY_API_TOKEN, + OktaAPIToken.JSON_PROPERTY_DOMAIN, + OktaAPIToken.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OktaAPIToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + private String domain; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OktaAPITokenType type; + + public OktaAPIToken() {} + + @JsonCreator + public OktaAPIToken( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_DOMAIN) String domain, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OktaAPITokenType type) { + this.apiToken = apiToken; + this.domain = domain; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OktaAPIToken apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The OktaAPIToken api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public OktaAPIToken domain(String domain) { + this.domain = domain; + return this; + } + + /** + * The OktaAPIToken domain. + * + * @return domain + */ + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public OktaAPIToken type(OktaAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OktaAPIToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OktaAPITokenType getType() { + return type; + } + + public void setType(OktaAPITokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OktaAPIToken + */ + @JsonAnySetter + public OktaAPIToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OktaAPIToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OktaAPIToken oktaApiToken = (OktaAPIToken) o; + return Objects.equals(this.apiToken, oktaApiToken.apiToken) + && Objects.equals(this.domain, oktaApiToken.domain) + && Objects.equals(this.type, oktaApiToken.type) + && Objects.equals(this.additionalProperties, oktaApiToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, domain, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OktaAPIToken {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaAPITokenType.java b/src/main/java/com/datadog/api/client/v2/model/OktaAPITokenType.java new file mode 100644 index 00000000000..fcbba2c307c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaAPITokenType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the OktaAPIToken object. */ +@JsonSerialize(using = OktaAPITokenType.OktaAPITokenTypeSerializer.class) +public class OktaAPITokenType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("OktaAPIToken")); + + public static final OktaAPITokenType OKTAAPITOKEN = new OktaAPITokenType("OktaAPIToken"); + + OktaAPITokenType(String value) { + super(value, allowedValues); + } + + public static class OktaAPITokenTypeSerializer extends StdSerializer { + public OktaAPITokenTypeSerializer(Class t) { + super(t); + } + + public OktaAPITokenTypeSerializer() { + this(null); + } + + @Override + public void serialize(OktaAPITokenType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OktaAPITokenType fromValue(String value) { + return new OktaAPITokenType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaAPITokenUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OktaAPITokenUpdate.java new file mode 100644 index 00000000000..a5b1ab42f71 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaAPITokenUpdate.java @@ -0,0 +1,204 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OktaAPIToken object. */ +@JsonPropertyOrder({ + OktaAPITokenUpdate.JSON_PROPERTY_API_TOKEN, + OktaAPITokenUpdate.JSON_PROPERTY_DOMAIN, + OktaAPITokenUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OktaAPITokenUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + private String domain; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OktaAPITokenType type; + + public OktaAPITokenUpdate() {} + + @JsonCreator + public OktaAPITokenUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OktaAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OktaAPITokenUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The OktaAPITokenUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public OktaAPITokenUpdate domain(String domain) { + this.domain = domain; + return this; + } + + /** + * The OktaAPITokenUpdate domain. + * + * @return domain + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public OktaAPITokenUpdate type(OktaAPITokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OktaAPIToken object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OktaAPITokenType getType() { + return type; + } + + public void setType(OktaAPITokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OktaAPITokenUpdate + */ + @JsonAnySetter + public OktaAPITokenUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OktaAPITokenUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OktaAPITokenUpdate oktaApiTokenUpdate = (OktaAPITokenUpdate) o; + return Objects.equals(this.apiToken, oktaApiTokenUpdate.apiToken) + && Objects.equals(this.domain, oktaApiTokenUpdate.domain) + && Objects.equals(this.type, oktaApiTokenUpdate.type) + && Objects.equals(this.additionalProperties, oktaApiTokenUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, domain, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OktaAPITokenUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaCredentials.java b/src/main/java/com/datadog/api/client/v2/model/OktaCredentials.java new file mode 100644 index 00000000000..a248e3eb1d1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = OktaCredentials.OktaCredentialsDeserializer.class) +@JsonSerialize(using = OktaCredentials.OktaCredentialsSerializer.class) +public class OktaCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(OktaCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OktaCredentialsSerializer extends StdSerializer { + public OktaCredentialsSerializer(Class t) { + super(t); + } + + public OktaCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(OktaCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OktaCredentialsDeserializer extends StdDeserializer { + public OktaCredentialsDeserializer() { + this(OktaCredentials.class); + } + + public OktaCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public OktaCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize OktaAPIToken + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OktaAPIToken.class.equals(Integer.class) + || OktaAPIToken.class.equals(Long.class) + || OktaAPIToken.class.equals(Float.class) + || OktaAPIToken.class.equals(Double.class) + || OktaAPIToken.class.equals(Boolean.class) + || OktaAPIToken.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OktaAPIToken.class.equals(Integer.class) || OktaAPIToken.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OktaAPIToken.class.equals(Float.class) || OktaAPIToken.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OktaAPIToken.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OktaAPIToken.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OktaAPIToken.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OktaAPIToken) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OktaAPIToken'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OktaAPIToken'", e); + } + + OktaCredentials ret = new OktaCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OktaCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "OktaCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OktaCredentials() { + super("oneOf", Boolean.FALSE); + } + + public OktaCredentials(OktaAPIToken o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("OktaAPIToken", new GenericType() {}); + JSON.registerDescendants(OktaCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OktaCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OktaAPIToken + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(OktaAPIToken.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be OktaAPIToken"); + } + + /** + * Get the actual instance, which can be the following: OktaAPIToken + * + * @return The actual instance (OktaAPIToken) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OktaAPIToken`. If the actual instance is not `OktaAPIToken`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `OktaAPIToken` + * @throws ClassCastException if the instance is not `OktaAPIToken` + */ + public OktaAPIToken getOktaAPIToken() throws ClassCastException { + return (OktaAPIToken) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OktaCredentialsUpdate.java new file mode 100644 index 00000000000..c765badf6a9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaCredentialsUpdate.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = OktaCredentialsUpdate.OktaCredentialsUpdateDeserializer.class) +@JsonSerialize(using = OktaCredentialsUpdate.OktaCredentialsUpdateSerializer.class) +public class OktaCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(OktaCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OktaCredentialsUpdateSerializer extends StdSerializer { + public OktaCredentialsUpdateSerializer(Class t) { + super(t); + } + + public OktaCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + OktaCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OktaCredentialsUpdateDeserializer + extends StdDeserializer { + public OktaCredentialsUpdateDeserializer() { + this(OktaCredentialsUpdate.class); + } + + public OktaCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public OktaCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize OktaAPITokenUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OktaAPITokenUpdate.class.equals(Integer.class) + || OktaAPITokenUpdate.class.equals(Long.class) + || OktaAPITokenUpdate.class.equals(Float.class) + || OktaAPITokenUpdate.class.equals(Double.class) + || OktaAPITokenUpdate.class.equals(Boolean.class) + || OktaAPITokenUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OktaAPITokenUpdate.class.equals(Integer.class) + || OktaAPITokenUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OktaAPITokenUpdate.class.equals(Float.class) + || OktaAPITokenUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OktaAPITokenUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OktaAPITokenUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OktaAPITokenUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OktaAPITokenUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OktaAPITokenUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OktaAPITokenUpdate'", e); + } + + OktaCredentialsUpdate ret = new OktaCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OktaCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "OktaCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OktaCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public OktaCredentialsUpdate(OktaAPITokenUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("OktaAPITokenUpdate", new GenericType() {}); + JSON.registerDescendants(OktaCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OktaCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OktaAPITokenUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(OktaAPITokenUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be OktaAPITokenUpdate"); + } + + /** + * Get the actual instance, which can be the following: OktaAPITokenUpdate + * + * @return The actual instance (OktaAPITokenUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OktaAPITokenUpdate`. If the actual instance is not + * `OktaAPITokenUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `OktaAPITokenUpdate` + * @throws ClassCastException if the instance is not `OktaAPITokenUpdate` + */ + public OktaAPITokenUpdate getOktaAPITokenUpdate() throws ClassCastException { + return (OktaAPITokenUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaIntegration.java b/src/main/java/com/datadog/api/client/v2/model/OktaIntegration.java new file mode 100644 index 00000000000..1034ba7c37c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaIntegration.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OktaIntegration object. */ +@JsonPropertyOrder({OktaIntegration.JSON_PROPERTY_CREDENTIALS, OktaIntegration.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OktaIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private OktaCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OktaIntegrationType type; + + public OktaIntegration() {} + + @JsonCreator + public OktaIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) OktaCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OktaIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OktaIntegration credentials(OktaCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the OktaCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OktaCredentials getCredentials() { + return credentials; + } + + public void setCredentials(OktaCredentials credentials) { + this.credentials = credentials; + } + + public OktaIntegration type(OktaIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OktaIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OktaIntegrationType getType() { + return type; + } + + public void setType(OktaIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OktaIntegration + */ + @JsonAnySetter + public OktaIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OktaIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OktaIntegration oktaIntegration = (OktaIntegration) o; + return Objects.equals(this.credentials, oktaIntegration.credentials) + && Objects.equals(this.type, oktaIntegration.type) + && Objects.equals(this.additionalProperties, oktaIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OktaIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/OktaIntegrationType.java new file mode 100644 index 00000000000..b1cc358f648 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the OktaIntegrationType object. */ +@JsonSerialize(using = OktaIntegrationType.OktaIntegrationTypeSerializer.class) +public class OktaIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Okta")); + + public static final OktaIntegrationType OKTA = new OktaIntegrationType("Okta"); + + OktaIntegrationType(String value) { + super(value, allowedValues); + } + + public static class OktaIntegrationTypeSerializer extends StdSerializer { + public OktaIntegrationTypeSerializer(Class t) { + super(t); + } + + public OktaIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OktaIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OktaIntegrationType fromValue(String value) { + return new OktaIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OktaIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OktaIntegrationUpdate.java new file mode 100644 index 00000000000..ca607d35fa1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OktaIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OktaIntegrationUpdate object. */ +@JsonPropertyOrder({ + OktaIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + OktaIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OktaIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private OktaCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OktaIntegrationType type; + + public OktaIntegrationUpdate() {} + + @JsonCreator + public OktaIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OktaIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OktaIntegrationUpdate credentials(OktaCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the OktaCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OktaCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(OktaCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public OktaIntegrationUpdate type(OktaIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OktaIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OktaIntegrationType getType() { + return type; + } + + public void setType(OktaIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OktaIntegrationUpdate + */ + @JsonAnySetter + public OktaIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OktaIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OktaIntegrationUpdate oktaIntegrationUpdate = (OktaIntegrationUpdate) o; + return Objects.equals(this.credentials, oktaIntegrationUpdate.credentials) + && Objects.equals(this.type, oktaIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, oktaIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OktaIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKey.java new file mode 100644 index 00000000000..7d36ac3596f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OpenAIAPIKey object. */ +@JsonPropertyOrder({OpenAIAPIKey.JSON_PROPERTY_API_TOKEN, OpenAIAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OpenAIAPIKeyType type; + + public OpenAIAPIKey() {} + + @JsonCreator + public OpenAIAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_TOKEN) String apiToken, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OpenAIAPIKeyType type) { + this.apiToken = apiToken; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OpenAIAPIKey apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The OpenAIAPIKey api_token. + * + * @return apiToken + */ + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public OpenAIAPIKey type(OpenAIAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OpenAIAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIAPIKeyType getType() { + return type; + } + + public void setType(OpenAIAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OpenAIAPIKey + */ + @JsonAnySetter + public OpenAIAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OpenAIAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIAPIKey openAiapiKey = (OpenAIAPIKey) o; + return Objects.equals(this.apiToken, openAiapiKey.apiToken) + && Objects.equals(this.type, openAiapiKey.type) + && Objects.equals(this.additionalProperties, openAiapiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIAPIKey {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKeyType.java new file mode 100644 index 00000000000..e6c610a7e0f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the OpenAIAPIKey object. */ +@JsonSerialize(using = OpenAIAPIKeyType.OpenAIAPIKeyTypeSerializer.class) +public class OpenAIAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("OpenAIAPIKey")); + + public static final OpenAIAPIKeyType OPENAIAPIKEY = new OpenAIAPIKeyType("OpenAIAPIKey"); + + OpenAIAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class OpenAIAPIKeyTypeSerializer extends StdSerializer { + public OpenAIAPIKeyTypeSerializer(Class t) { + super(t); + } + + public OpenAIAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(OpenAIAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OpenAIAPIKeyType fromValue(String value) { + return new OpenAIAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKeyUpdate.java new file mode 100644 index 00000000000..23bc4cd0ea5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OpenAIAPIKey object. */ +@JsonPropertyOrder({ + OpenAIAPIKeyUpdate.JSON_PROPERTY_API_TOKEN, + OpenAIAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_TOKEN = "api_token"; + private String apiToken; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OpenAIAPIKeyType type; + + public OpenAIAPIKeyUpdate() {} + + @JsonCreator + public OpenAIAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OpenAIAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OpenAIAPIKeyUpdate apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + /** + * The OpenAIAPIKeyUpdate api_token. + * + * @return apiToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } + + public OpenAIAPIKeyUpdate type(OpenAIAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OpenAIAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIAPIKeyType getType() { + return type; + } + + public void setType(OpenAIAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OpenAIAPIKeyUpdate + */ + @JsonAnySetter + public OpenAIAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OpenAIAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIAPIKeyUpdate openAiapiKeyUpdate = (OpenAIAPIKeyUpdate) o; + return Objects.equals(this.apiToken, openAiapiKeyUpdate.apiToken) + && Objects.equals(this.type, openAiapiKeyUpdate.type) + && Objects.equals(this.additionalProperties, openAiapiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiToken, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIAPIKeyUpdate {\n"); + sb.append(" apiToken: ").append(toIndentedString(apiToken)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAICredentials.java b/src/main/java/com/datadog/api/client/v2/model/OpenAICredentials.java new file mode 100644 index 00000000000..d7d9dc5f4ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAICredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = OpenAICredentials.OpenAICredentialsDeserializer.class) +@JsonSerialize(using = OpenAICredentials.OpenAICredentialsSerializer.class) +public class OpenAICredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(OpenAICredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OpenAICredentialsSerializer extends StdSerializer { + public OpenAICredentialsSerializer(Class t) { + super(t); + } + + public OpenAICredentialsSerializer() { + this(null); + } + + @Override + public void serialize(OpenAICredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OpenAICredentialsDeserializer extends StdDeserializer { + public OpenAICredentialsDeserializer() { + this(OpenAICredentials.class); + } + + public OpenAICredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public OpenAICredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize OpenAIAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIAPIKey.class.equals(Integer.class) + || OpenAIAPIKey.class.equals(Long.class) + || OpenAIAPIKey.class.equals(Float.class) + || OpenAIAPIKey.class.equals(Double.class) + || OpenAIAPIKey.class.equals(Boolean.class) + || OpenAIAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIAPIKey.class.equals(Integer.class) || OpenAIAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIAPIKey.class.equals(Float.class) || OpenAIAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OpenAIAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OpenAIAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OpenAIAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OpenAIAPIKey'", e); + } + + OpenAICredentials ret = new OpenAICredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OpenAICredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "OpenAICredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OpenAICredentials() { + super("oneOf", Boolean.FALSE); + } + + public OpenAICredentials(OpenAIAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("OpenAIAPIKey", new GenericType() {}); + JSON.registerDescendants(OpenAICredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OpenAICredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OpenAIAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(OpenAIAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be OpenAIAPIKey"); + } + + /** + * Get the actual instance, which can be the following: OpenAIAPIKey + * + * @return The actual instance (OpenAIAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIAPIKey`. If the actual instance is not `OpenAIAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIAPIKey` + * @throws ClassCastException if the instance is not `OpenAIAPIKey` + */ + public OpenAIAPIKey getOpenAIAPIKey() throws ClassCastException { + return (OpenAIAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAICredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OpenAICredentialsUpdate.java new file mode 100644 index 00000000000..9c475487f8b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAICredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = OpenAICredentialsUpdate.OpenAICredentialsUpdateDeserializer.class) +@JsonSerialize(using = OpenAICredentialsUpdate.OpenAICredentialsUpdateSerializer.class) +public class OpenAICredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(OpenAICredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OpenAICredentialsUpdateSerializer + extends StdSerializer { + public OpenAICredentialsUpdateSerializer(Class t) { + super(t); + } + + public OpenAICredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + OpenAICredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OpenAICredentialsUpdateDeserializer + extends StdDeserializer { + public OpenAICredentialsUpdateDeserializer() { + this(OpenAICredentialsUpdate.class); + } + + public OpenAICredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public OpenAICredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize OpenAIAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIAPIKeyUpdate.class.equals(Integer.class) + || OpenAIAPIKeyUpdate.class.equals(Long.class) + || OpenAIAPIKeyUpdate.class.equals(Float.class) + || OpenAIAPIKeyUpdate.class.equals(Double.class) + || OpenAIAPIKeyUpdate.class.equals(Boolean.class) + || OpenAIAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIAPIKeyUpdate.class.equals(Integer.class) + || OpenAIAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIAPIKeyUpdate.class.equals(Float.class) + || OpenAIAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(OpenAIAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((OpenAIAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'OpenAIAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'OpenAIAPIKeyUpdate'", e); + } + + OpenAICredentialsUpdate ret = new OpenAICredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OpenAICredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "OpenAICredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OpenAICredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public OpenAICredentialsUpdate(OpenAIAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("OpenAIAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(OpenAICredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OpenAICredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OpenAIAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(OpenAIAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be OpenAIAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: OpenAIAPIKeyUpdate + * + * @return The actual instance (OpenAIAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIAPIKeyUpdate`. If the actual instance is not + * `OpenAIAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIAPIKeyUpdate` + * @throws ClassCastException if the instance is not `OpenAIAPIKeyUpdate` + */ + public OpenAIAPIKeyUpdate getOpenAIAPIKeyUpdate() throws ClassCastException { + return (OpenAIAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegration.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegration.java new file mode 100644 index 00000000000..d119ef8c4f1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OpenAIIntegration object. */ +@JsonPropertyOrder({ + OpenAIIntegration.JSON_PROPERTY_CREDENTIALS, + OpenAIIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private OpenAICredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OpenAIIntegrationType type; + + public OpenAIIntegration() {} + + @JsonCreator + public OpenAIIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + OpenAICredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OpenAIIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OpenAIIntegration credentials(OpenAICredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the OpenAICredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAICredentials getCredentials() { + return credentials; + } + + public void setCredentials(OpenAICredentials credentials) { + this.credentials = credentials; + } + + public OpenAIIntegration type(OpenAIIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OpenAIIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIIntegrationType getType() { + return type; + } + + public void setType(OpenAIIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OpenAIIntegration + */ + @JsonAnySetter + public OpenAIIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OpenAIIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIIntegration openAiIntegration = (OpenAIIntegration) o; + return Objects.equals(this.credentials, openAiIntegration.credentials) + && Objects.equals(this.type, openAiIntegration.type) + && Objects.equals(this.additionalProperties, openAiIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegrationType.java new file mode 100644 index 00000000000..2e9f9374222 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the OpenAIIntegrationType object. */ +@JsonSerialize(using = OpenAIIntegrationType.OpenAIIntegrationTypeSerializer.class) +public class OpenAIIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("OpenAI")); + + public static final OpenAIIntegrationType OPENAI = new OpenAIIntegrationType("OpenAI"); + + OpenAIIntegrationType(String value) { + super(value, allowedValues); + } + + public static class OpenAIIntegrationTypeSerializer extends StdSerializer { + public OpenAIIntegrationTypeSerializer(Class t) { + super(t); + } + + public OpenAIIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OpenAIIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OpenAIIntegrationType fromValue(String value) { + return new OpenAIIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegrationUpdate.java new file mode 100644 index 00000000000..59c2a13a0f3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the OpenAIIntegrationUpdate object. */ +@JsonPropertyOrder({ + OpenAIIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + OpenAIIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private OpenAICredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OpenAIIntegrationType type; + + public OpenAIIntegrationUpdate() {} + + @JsonCreator + public OpenAIIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OpenAIIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OpenAIIntegrationUpdate credentials(OpenAICredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the OpenAICredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAICredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(OpenAICredentialsUpdate credentials) { + this.credentials = credentials; + } + + public OpenAIIntegrationUpdate type(OpenAIIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the OpenAIIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIIntegrationType getType() { + return type; + } + + public void setType(OpenAIIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OpenAIIntegrationUpdate + */ + @JsonAnySetter + public OpenAIIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OpenAIIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIIntegrationUpdate openAiIntegrationUpdate = (OpenAIIntegrationUpdate) o; + return Objects.equals(this.credentials, openAiIntegrationUpdate.credentials) + && Objects.equals(this.type, openAiIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, openAiIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuth.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuth.java new file mode 100644 index 00000000000..7017c0e73ab --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuth.java @@ -0,0 +1,234 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ServiceNowBasicAuth object. */ +@JsonPropertyOrder({ + ServiceNowBasicAuth.JSON_PROPERTY_INSTANCE, + ServiceNowBasicAuth.JSON_PROPERTY_PASSWORD, + ServiceNowBasicAuth.JSON_PROPERTY_TYPE, + ServiceNowBasicAuth.JSON_PROPERTY_USERNAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceNowBasicAuth { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INSTANCE = "instance"; + private String instance; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ServiceNowBasicAuthType type; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public ServiceNowBasicAuth() {} + + @JsonCreator + public ServiceNowBasicAuth( + @JsonProperty(required = true, value = JSON_PROPERTY_INSTANCE) String instance, + @JsonProperty(required = true, value = JSON_PROPERTY_PASSWORD) String password, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ServiceNowBasicAuthType type, + @JsonProperty(required = true, value = JSON_PROPERTY_USERNAME) String username) { + this.instance = instance; + this.password = password; + this.type = type; + this.unparsed |= !type.isValid(); + this.username = username; + } + + public ServiceNowBasicAuth instance(String instance) { + this.instance = instance; + return this; + } + + /** + * The ServiceNowBasicAuth instance. + * + * @return instance + */ + @JsonProperty(JSON_PROPERTY_INSTANCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getInstance() { + return instance; + } + + public void setInstance(String instance) { + this.instance = instance; + } + + public ServiceNowBasicAuth password(String password) { + this.password = password; + return this; + } + + /** + * The ServiceNowBasicAuth password. + * + * @return password + */ + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public ServiceNowBasicAuth type(ServiceNowBasicAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ServiceNowBasicAuth object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceNowBasicAuthType getType() { + return type; + } + + public void setType(ServiceNowBasicAuthType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public ServiceNowBasicAuth username(String username) { + this.username = username; + return this; + } + + /** + * The ServiceNowBasicAuth username. + * + * @return username + */ + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ServiceNowBasicAuth + */ + @JsonAnySetter + public ServiceNowBasicAuth putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ServiceNowBasicAuth object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceNowBasicAuth serviceNowBasicAuth = (ServiceNowBasicAuth) o; + return Objects.equals(this.instance, serviceNowBasicAuth.instance) + && Objects.equals(this.password, serviceNowBasicAuth.password) + && Objects.equals(this.type, serviceNowBasicAuth.type) + && Objects.equals(this.username, serviceNowBasicAuth.username) + && Objects.equals(this.additionalProperties, serviceNowBasicAuth.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(instance, password, type, username, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceNowBasicAuth {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuthType.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuthType.java new file mode 100644 index 00000000000..014f9704e4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuthType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the ServiceNowBasicAuth object. */ +@JsonSerialize(using = ServiceNowBasicAuthType.ServiceNowBasicAuthTypeSerializer.class) +public class ServiceNowBasicAuthType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ServiceNowBasicAuth")); + + public static final ServiceNowBasicAuthType SERVICENOWBASICAUTH = + new ServiceNowBasicAuthType("ServiceNowBasicAuth"); + + ServiceNowBasicAuthType(String value) { + super(value, allowedValues); + } + + public static class ServiceNowBasicAuthTypeSerializer + extends StdSerializer { + public ServiceNowBasicAuthTypeSerializer(Class t) { + super(t); + } + + public ServiceNowBasicAuthTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ServiceNowBasicAuthType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ServiceNowBasicAuthType fromValue(String value) { + return new ServiceNowBasicAuthType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuthUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuthUpdate.java new file mode 100644 index 00000000000..851549e0987 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowBasicAuthUpdate.java @@ -0,0 +1,232 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ServiceNowBasicAuth object. */ +@JsonPropertyOrder({ + ServiceNowBasicAuthUpdate.JSON_PROPERTY_INSTANCE, + ServiceNowBasicAuthUpdate.JSON_PROPERTY_PASSWORD, + ServiceNowBasicAuthUpdate.JSON_PROPERTY_TYPE, + ServiceNowBasicAuthUpdate.JSON_PROPERTY_USERNAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceNowBasicAuthUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INSTANCE = "instance"; + private String instance; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ServiceNowBasicAuthType type; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public ServiceNowBasicAuthUpdate() {} + + @JsonCreator + public ServiceNowBasicAuthUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ServiceNowBasicAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ServiceNowBasicAuthUpdate instance(String instance) { + this.instance = instance; + return this; + } + + /** + * The ServiceNowBasicAuthUpdate instance. + * + * @return instance + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INSTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getInstance() { + return instance; + } + + public void setInstance(String instance) { + this.instance = instance; + } + + public ServiceNowBasicAuthUpdate password(String password) { + this.password = password; + return this; + } + + /** + * The ServiceNowBasicAuthUpdate password. + * + * @return password + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public ServiceNowBasicAuthUpdate type(ServiceNowBasicAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ServiceNowBasicAuth object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceNowBasicAuthType getType() { + return type; + } + + public void setType(ServiceNowBasicAuthType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public ServiceNowBasicAuthUpdate username(String username) { + this.username = username; + return this; + } + + /** + * The ServiceNowBasicAuthUpdate username. + * + * @return username + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ServiceNowBasicAuthUpdate + */ + @JsonAnySetter + public ServiceNowBasicAuthUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ServiceNowBasicAuthUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceNowBasicAuthUpdate serviceNowBasicAuthUpdate = (ServiceNowBasicAuthUpdate) o; + return Objects.equals(this.instance, serviceNowBasicAuthUpdate.instance) + && Objects.equals(this.password, serviceNowBasicAuthUpdate.password) + && Objects.equals(this.type, serviceNowBasicAuthUpdate.type) + && Objects.equals(this.username, serviceNowBasicAuthUpdate.username) + && Objects.equals( + this.additionalProperties, serviceNowBasicAuthUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(instance, password, type, username, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceNowBasicAuthUpdate {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowCredentials.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowCredentials.java new file mode 100644 index 00000000000..9ce348d0dc4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowCredentials.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ServiceNowCredentials.ServiceNowCredentialsDeserializer.class) +@JsonSerialize(using = ServiceNowCredentials.ServiceNowCredentialsSerializer.class) +public class ServiceNowCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ServiceNowCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ServiceNowCredentialsSerializer extends StdSerializer { + public ServiceNowCredentialsSerializer(Class t) { + super(t); + } + + public ServiceNowCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + ServiceNowCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ServiceNowCredentialsDeserializer + extends StdDeserializer { + public ServiceNowCredentialsDeserializer() { + this(ServiceNowCredentials.class); + } + + public ServiceNowCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public ServiceNowCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ServiceNowBasicAuth + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ServiceNowBasicAuth.class.equals(Integer.class) + || ServiceNowBasicAuth.class.equals(Long.class) + || ServiceNowBasicAuth.class.equals(Float.class) + || ServiceNowBasicAuth.class.equals(Double.class) + || ServiceNowBasicAuth.class.equals(Boolean.class) + || ServiceNowBasicAuth.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ServiceNowBasicAuth.class.equals(Integer.class) + || ServiceNowBasicAuth.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ServiceNowBasicAuth.class.equals(Float.class) + || ServiceNowBasicAuth.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ServiceNowBasicAuth.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ServiceNowBasicAuth.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ServiceNowBasicAuth.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ServiceNowBasicAuth) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ServiceNowBasicAuth'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ServiceNowBasicAuth'", e); + } + + ServiceNowCredentials ret = new ServiceNowCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ServiceNowCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ServiceNowCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ServiceNowCredentials() { + super("oneOf", Boolean.FALSE); + } + + public ServiceNowCredentials(ServiceNowBasicAuth o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ServiceNowBasicAuth", new GenericType() {}); + JSON.registerDescendants(ServiceNowCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ServiceNowCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ServiceNowBasicAuth + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ServiceNowBasicAuth.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ServiceNowBasicAuth"); + } + + /** + * Get the actual instance, which can be the following: ServiceNowBasicAuth + * + * @return The actual instance (ServiceNowBasicAuth) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ServiceNowBasicAuth`. If the actual instance is not + * `ServiceNowBasicAuth`, the ClassCastException will be thrown. + * + * @return The actual instance of `ServiceNowBasicAuth` + * @throws ClassCastException if the instance is not `ServiceNowBasicAuth` + */ + public ServiceNowBasicAuth getServiceNowBasicAuth() throws ClassCastException { + return (ServiceNowBasicAuth) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowCredentialsUpdate.java new file mode 100644 index 00000000000..84f584ae267 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowCredentialsUpdate.java @@ -0,0 +1,215 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ServiceNowCredentialsUpdate.ServiceNowCredentialsUpdateDeserializer.class) +@JsonSerialize(using = ServiceNowCredentialsUpdate.ServiceNowCredentialsUpdateSerializer.class) +public class ServiceNowCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ServiceNowCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ServiceNowCredentialsUpdateSerializer + extends StdSerializer { + public ServiceNowCredentialsUpdateSerializer(Class t) { + super(t); + } + + public ServiceNowCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + ServiceNowCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ServiceNowCredentialsUpdateDeserializer + extends StdDeserializer { + public ServiceNowCredentialsUpdateDeserializer() { + this(ServiceNowCredentialsUpdate.class); + } + + public ServiceNowCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public ServiceNowCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ServiceNowBasicAuthUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ServiceNowBasicAuthUpdate.class.equals(Integer.class) + || ServiceNowBasicAuthUpdate.class.equals(Long.class) + || ServiceNowBasicAuthUpdate.class.equals(Float.class) + || ServiceNowBasicAuthUpdate.class.equals(Double.class) + || ServiceNowBasicAuthUpdate.class.equals(Boolean.class) + || ServiceNowBasicAuthUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ServiceNowBasicAuthUpdate.class.equals(Integer.class) + || ServiceNowBasicAuthUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ServiceNowBasicAuthUpdate.class.equals(Float.class) + || ServiceNowBasicAuthUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ServiceNowBasicAuthUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ServiceNowBasicAuthUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ServiceNowBasicAuthUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ServiceNowBasicAuthUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ServiceNowBasicAuthUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ServiceNowBasicAuthUpdate'", e); + } + + ServiceNowCredentialsUpdate ret = new ServiceNowCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ServiceNowCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "ServiceNowCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ServiceNowCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public ServiceNowCredentialsUpdate(ServiceNowBasicAuthUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ServiceNowBasicAuthUpdate", new GenericType() {}); + JSON.registerDescendants( + ServiceNowCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ServiceNowCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ServiceNowBasicAuthUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ServiceNowBasicAuthUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ServiceNowBasicAuthUpdate"); + } + + /** + * Get the actual instance, which can be the following: ServiceNowBasicAuthUpdate + * + * @return The actual instance (ServiceNowBasicAuthUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ServiceNowBasicAuthUpdate`. If the actual instance is not + * `ServiceNowBasicAuthUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `ServiceNowBasicAuthUpdate` + * @throws ClassCastException if the instance is not `ServiceNowBasicAuthUpdate` + */ + public ServiceNowBasicAuthUpdate getServiceNowBasicAuthUpdate() throws ClassCastException { + return (ServiceNowBasicAuthUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegration.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegration.java new file mode 100644 index 00000000000..eaa5ed1ef96 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ServiceNowIntegration object. */ +@JsonPropertyOrder({ + ServiceNowIntegration.JSON_PROPERTY_CREDENTIALS, + ServiceNowIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceNowIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private ServiceNowCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ServiceNowIntegrationType type; + + public ServiceNowIntegration() {} + + @JsonCreator + public ServiceNowIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + ServiceNowCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ServiceNowIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ServiceNowIntegration credentials(ServiceNowCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the ServiceNowCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceNowCredentials getCredentials() { + return credentials; + } + + public void setCredentials(ServiceNowCredentials credentials) { + this.credentials = credentials; + } + + public ServiceNowIntegration type(ServiceNowIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ServiceNowIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceNowIntegrationType getType() { + return type; + } + + public void setType(ServiceNowIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ServiceNowIntegration + */ + @JsonAnySetter + public ServiceNowIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ServiceNowIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceNowIntegration serviceNowIntegration = (ServiceNowIntegration) o; + return Objects.equals(this.credentials, serviceNowIntegration.credentials) + && Objects.equals(this.type, serviceNowIntegration.type) + && Objects.equals(this.additionalProperties, serviceNowIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceNowIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegrationType.java new file mode 100644 index 00000000000..bbf2168e1c9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegrationType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the ServiceNowIntegrationType object. */ +@JsonSerialize(using = ServiceNowIntegrationType.ServiceNowIntegrationTypeSerializer.class) +public class ServiceNowIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("ServiceNow")); + + public static final ServiceNowIntegrationType SERVICENOW = + new ServiceNowIntegrationType("ServiceNow"); + + ServiceNowIntegrationType(String value) { + super(value, allowedValues); + } + + public static class ServiceNowIntegrationTypeSerializer + extends StdSerializer { + public ServiceNowIntegrationTypeSerializer(Class t) { + super(t); + } + + public ServiceNowIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ServiceNowIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ServiceNowIntegrationType fromValue(String value) { + return new ServiceNowIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegrationUpdate.java new file mode 100644 index 00000000000..c1f292e6d7a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceNowIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the ServiceNowIntegrationUpdate object. */ +@JsonPropertyOrder({ + ServiceNowIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + ServiceNowIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceNowIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private ServiceNowCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ServiceNowIntegrationType type; + + public ServiceNowIntegrationUpdate() {} + + @JsonCreator + public ServiceNowIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ServiceNowIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ServiceNowIntegrationUpdate credentials(ServiceNowCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the ServiceNowCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ServiceNowCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(ServiceNowCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public ServiceNowIntegrationUpdate type(ServiceNowIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the ServiceNowIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceNowIntegrationType getType() { + return type; + } + + public void setType(ServiceNowIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ServiceNowIntegrationUpdate + */ + @JsonAnySetter + public ServiceNowIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ServiceNowIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceNowIntegrationUpdate serviceNowIntegrationUpdate = (ServiceNowIntegrationUpdate) o; + return Objects.equals(this.credentials, serviceNowIntegrationUpdate.credentials) + && Objects.equals(this.type, serviceNowIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, serviceNowIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceNowIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/SplitAPIKey.java new file mode 100644 index 00000000000..c2b33f1c98f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the SplitAPIKey object. */ +@JsonPropertyOrder({SplitAPIKey.JSON_PROPERTY_API_KEY, SplitAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SplitAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SplitAPIKeyType type; + + public SplitAPIKey() {} + + @JsonCreator + public SplitAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SplitAPIKeyType type) { + this.apiKey = apiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SplitAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The SplitAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public SplitAPIKey type(SplitAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the SplitAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SplitAPIKeyType getType() { + return type; + } + + public void setType(SplitAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SplitAPIKey + */ + @JsonAnySetter + public SplitAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SplitAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SplitAPIKey splitApiKey = (SplitAPIKey) o; + return Objects.equals(this.apiKey, splitApiKey.apiKey) + && Objects.equals(this.type, splitApiKey.type) + && Objects.equals(this.additionalProperties, splitApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SplitAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/SplitAPIKeyType.java new file mode 100644 index 00000000000..37c58254ded --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the SplitAPIKey object. */ +@JsonSerialize(using = SplitAPIKeyType.SplitAPIKeyTypeSerializer.class) +public class SplitAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("SplitAPIKey")); + + public static final SplitAPIKeyType SPLITAPIKEY = new SplitAPIKeyType("SplitAPIKey"); + + SplitAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class SplitAPIKeyTypeSerializer extends StdSerializer { + public SplitAPIKeyTypeSerializer(Class t) { + super(t); + } + + public SplitAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(SplitAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SplitAPIKeyType fromValue(String value) { + return new SplitAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/SplitAPIKeyUpdate.java new file mode 100644 index 00000000000..aa23ca8729d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitAPIKeyUpdate.java @@ -0,0 +1,174 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the SplitAPIKey object. */ +@JsonPropertyOrder({SplitAPIKeyUpdate.JSON_PROPERTY_API_KEY, SplitAPIKeyUpdate.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SplitAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SplitAPIKeyType type; + + public SplitAPIKeyUpdate() {} + + @JsonCreator + public SplitAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SplitAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SplitAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The SplitAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public SplitAPIKeyUpdate type(SplitAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the SplitAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SplitAPIKeyType getType() { + return type; + } + + public void setType(SplitAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SplitAPIKeyUpdate + */ + @JsonAnySetter + public SplitAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SplitAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SplitAPIKeyUpdate splitApiKeyUpdate = (SplitAPIKeyUpdate) o; + return Objects.equals(this.apiKey, splitApiKeyUpdate.apiKey) + && Objects.equals(this.type, splitApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, splitApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SplitAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitCredentials.java b/src/main/java/com/datadog/api/client/v2/model/SplitCredentials.java new file mode 100644 index 00000000000..9405bc3494b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitCredentials.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = SplitCredentials.SplitCredentialsDeserializer.class) +@JsonSerialize(using = SplitCredentials.SplitCredentialsSerializer.class) +public class SplitCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SplitCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class SplitCredentialsSerializer extends StdSerializer { + public SplitCredentialsSerializer(Class t) { + super(t); + } + + public SplitCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(SplitCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class SplitCredentialsDeserializer extends StdDeserializer { + public SplitCredentialsDeserializer() { + this(SplitCredentials.class); + } + + public SplitCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public SplitCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize SplitAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SplitAPIKey.class.equals(Integer.class) + || SplitAPIKey.class.equals(Long.class) + || SplitAPIKey.class.equals(Float.class) + || SplitAPIKey.class.equals(Double.class) + || SplitAPIKey.class.equals(Boolean.class) + || SplitAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SplitAPIKey.class.equals(Integer.class) || SplitAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SplitAPIKey.class.equals(Float.class) || SplitAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SplitAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SplitAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SplitAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SplitAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SplitAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SplitAPIKey'", e); + } + + SplitCredentials ret = new SplitCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SplitCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "SplitCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public SplitCredentials() { + super("oneOf", Boolean.FALSE); + } + + public SplitCredentials(SplitAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SplitAPIKey", new GenericType() {}); + JSON.registerDescendants(SplitCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return SplitCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SplitAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(SplitAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be SplitAPIKey"); + } + + /** + * Get the actual instance, which can be the following: SplitAPIKey + * + * @return The actual instance (SplitAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SplitAPIKey`. If the actual instance is not `SplitAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `SplitAPIKey` + * @throws ClassCastException if the instance is not `SplitAPIKey` + */ + public SplitAPIKey getSplitAPIKey() throws ClassCastException { + return (SplitAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/SplitCredentialsUpdate.java new file mode 100644 index 00000000000..a667892d109 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = SplitCredentialsUpdate.SplitCredentialsUpdateDeserializer.class) +@JsonSerialize(using = SplitCredentialsUpdate.SplitCredentialsUpdateSerializer.class) +public class SplitCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SplitCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class SplitCredentialsUpdateSerializer + extends StdSerializer { + public SplitCredentialsUpdateSerializer(Class t) { + super(t); + } + + public SplitCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + SplitCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class SplitCredentialsUpdateDeserializer + extends StdDeserializer { + public SplitCredentialsUpdateDeserializer() { + this(SplitCredentialsUpdate.class); + } + + public SplitCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public SplitCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize SplitAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SplitAPIKeyUpdate.class.equals(Integer.class) + || SplitAPIKeyUpdate.class.equals(Long.class) + || SplitAPIKeyUpdate.class.equals(Float.class) + || SplitAPIKeyUpdate.class.equals(Double.class) + || SplitAPIKeyUpdate.class.equals(Boolean.class) + || SplitAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SplitAPIKeyUpdate.class.equals(Integer.class) + || SplitAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SplitAPIKeyUpdate.class.equals(Float.class) + || SplitAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SplitAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SplitAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SplitAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SplitAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SplitAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SplitAPIKeyUpdate'", e); + } + + SplitCredentialsUpdate ret = new SplitCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SplitCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "SplitCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public SplitCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public SplitCredentialsUpdate(SplitAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SplitAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(SplitCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return SplitCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SplitAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(SplitAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be SplitAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: SplitAPIKeyUpdate + * + * @return The actual instance (SplitAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SplitAPIKeyUpdate`. If the actual instance is not + * `SplitAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `SplitAPIKeyUpdate` + * @throws ClassCastException if the instance is not `SplitAPIKeyUpdate` + */ + public SplitAPIKeyUpdate getSplitAPIKeyUpdate() throws ClassCastException { + return (SplitAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitIntegration.java b/src/main/java/com/datadog/api/client/v2/model/SplitIntegration.java new file mode 100644 index 00000000000..04a3cc4c8d3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the SplitIntegration object. */ +@JsonPropertyOrder({ + SplitIntegration.JSON_PROPERTY_CREDENTIALS, + SplitIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SplitIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private SplitCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SplitIntegrationType type; + + public SplitIntegration() {} + + @JsonCreator + public SplitIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + SplitCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SplitIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SplitIntegration credentials(SplitCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the SplitCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SplitCredentials getCredentials() { + return credentials; + } + + public void setCredentials(SplitCredentials credentials) { + this.credentials = credentials; + } + + public SplitIntegration type(SplitIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the SplitIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SplitIntegrationType getType() { + return type; + } + + public void setType(SplitIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SplitIntegration + */ + @JsonAnySetter + public SplitIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SplitIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SplitIntegration splitIntegration = (SplitIntegration) o; + return Objects.equals(this.credentials, splitIntegration.credentials) + && Objects.equals(this.type, splitIntegration.type) + && Objects.equals(this.additionalProperties, splitIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SplitIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/SplitIntegrationType.java new file mode 100644 index 00000000000..1e27c0258d3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitIntegrationType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the SplitIntegrationType object. */ +@JsonSerialize(using = SplitIntegrationType.SplitIntegrationTypeSerializer.class) +public class SplitIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Split")); + + public static final SplitIntegrationType SPLIT = new SplitIntegrationType("Split"); + + SplitIntegrationType(String value) { + super(value, allowedValues); + } + + public static class SplitIntegrationTypeSerializer extends StdSerializer { + public SplitIntegrationTypeSerializer(Class t) { + super(t); + } + + public SplitIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SplitIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SplitIntegrationType fromValue(String value) { + return new SplitIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SplitIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/SplitIntegrationUpdate.java new file mode 100644 index 00000000000..996dff171a7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SplitIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the SplitIntegrationUpdate object. */ +@JsonPropertyOrder({ + SplitIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + SplitIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SplitIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private SplitCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SplitIntegrationType type; + + public SplitIntegrationUpdate() {} + + @JsonCreator + public SplitIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SplitIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SplitIntegrationUpdate credentials(SplitCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the SplitCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SplitCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(SplitCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public SplitIntegrationUpdate type(SplitIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the SplitIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SplitIntegrationType getType() { + return type; + } + + public void setType(SplitIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SplitIntegrationUpdate + */ + @JsonAnySetter + public SplitIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SplitIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SplitIntegrationUpdate splitIntegrationUpdate = (SplitIntegrationUpdate) o; + return Objects.equals(this.credentials, splitIntegrationUpdate.credentials) + && Objects.equals(this.type, splitIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, splitIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SplitIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKey.java new file mode 100644 index 00000000000..531212a4b59 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the StatsigAPIKey object. */ +@JsonPropertyOrder({StatsigAPIKey.JSON_PROPERTY_API_KEY, StatsigAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StatsigAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private StatsigAPIKeyType type; + + public StatsigAPIKey() {} + + @JsonCreator + public StatsigAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) StatsigAPIKeyType type) { + this.apiKey = apiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public StatsigAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The StatsigAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public StatsigAPIKey type(StatsigAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the StatsigAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatsigAPIKeyType getType() { + return type; + } + + public void setType(StatsigAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return StatsigAPIKey + */ + @JsonAnySetter + public StatsigAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this StatsigAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatsigAPIKey statsigApiKey = (StatsigAPIKey) o; + return Objects.equals(this.apiKey, statsigApiKey.apiKey) + && Objects.equals(this.type, statsigApiKey.type) + && Objects.equals(this.additionalProperties, statsigApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatsigAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKeyType.java new file mode 100644 index 00000000000..e97e6d5b0a1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the StatsigAPIKey object. */ +@JsonSerialize(using = StatsigAPIKeyType.StatsigAPIKeyTypeSerializer.class) +public class StatsigAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("StatsigAPIKey")); + + public static final StatsigAPIKeyType STATSIGAPIKEY = new StatsigAPIKeyType("StatsigAPIKey"); + + StatsigAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class StatsigAPIKeyTypeSerializer extends StdSerializer { + public StatsigAPIKeyTypeSerializer(Class t) { + super(t); + } + + public StatsigAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(StatsigAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static StatsigAPIKeyType fromValue(String value) { + return new StatsigAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKeyUpdate.java new file mode 100644 index 00000000000..912260c3ee3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the StatsigAPIKey object. */ +@JsonPropertyOrder({ + StatsigAPIKeyUpdate.JSON_PROPERTY_API_KEY, + StatsigAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StatsigAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private StatsigAPIKeyType type; + + public StatsigAPIKeyUpdate() {} + + @JsonCreator + public StatsigAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) StatsigAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public StatsigAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The StatsigAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public StatsigAPIKeyUpdate type(StatsigAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the StatsigAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatsigAPIKeyType getType() { + return type; + } + + public void setType(StatsigAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return StatsigAPIKeyUpdate + */ + @JsonAnySetter + public StatsigAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this StatsigAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatsigAPIKeyUpdate statsigApiKeyUpdate = (StatsigAPIKeyUpdate) o; + return Objects.equals(this.apiKey, statsigApiKeyUpdate.apiKey) + && Objects.equals(this.type, statsigApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, statsigApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatsigAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigCredentials.java b/src/main/java/com/datadog/api/client/v2/model/StatsigCredentials.java new file mode 100644 index 00000000000..4baec352af9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigCredentials.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = StatsigCredentials.StatsigCredentialsDeserializer.class) +@JsonSerialize(using = StatsigCredentials.StatsigCredentialsSerializer.class) +public class StatsigCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(StatsigCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class StatsigCredentialsSerializer extends StdSerializer { + public StatsigCredentialsSerializer(Class t) { + super(t); + } + + public StatsigCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(StatsigCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class StatsigCredentialsDeserializer extends StdDeserializer { + public StatsigCredentialsDeserializer() { + this(StatsigCredentials.class); + } + + public StatsigCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public StatsigCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize StatsigAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (StatsigAPIKey.class.equals(Integer.class) + || StatsigAPIKey.class.equals(Long.class) + || StatsigAPIKey.class.equals(Float.class) + || StatsigAPIKey.class.equals(Double.class) + || StatsigAPIKey.class.equals(Boolean.class) + || StatsigAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((StatsigAPIKey.class.equals(Integer.class) + || StatsigAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((StatsigAPIKey.class.equals(Float.class) + || StatsigAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (StatsigAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (StatsigAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(StatsigAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((StatsigAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'StatsigAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'StatsigAPIKey'", e); + } + + StatsigCredentials ret = new StatsigCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public StatsigCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "StatsigCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public StatsigCredentials() { + super("oneOf", Boolean.FALSE); + } + + public StatsigCredentials(StatsigAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("StatsigAPIKey", new GenericType() {}); + JSON.registerDescendants(StatsigCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return StatsigCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: StatsigAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(StatsigAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be StatsigAPIKey"); + } + + /** + * Get the actual instance, which can be the following: StatsigAPIKey + * + * @return The actual instance (StatsigAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `StatsigAPIKey`. If the actual instance is not `StatsigAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `StatsigAPIKey` + * @throws ClassCastException if the instance is not `StatsigAPIKey` + */ + public StatsigAPIKey getStatsigAPIKey() throws ClassCastException { + return (StatsigAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/StatsigCredentialsUpdate.java new file mode 100644 index 00000000000..0947b15e2df --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = StatsigCredentialsUpdate.StatsigCredentialsUpdateDeserializer.class) +@JsonSerialize(using = StatsigCredentialsUpdate.StatsigCredentialsUpdateSerializer.class) +public class StatsigCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(StatsigCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class StatsigCredentialsUpdateSerializer + extends StdSerializer { + public StatsigCredentialsUpdateSerializer(Class t) { + super(t); + } + + public StatsigCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + StatsigCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class StatsigCredentialsUpdateDeserializer + extends StdDeserializer { + public StatsigCredentialsUpdateDeserializer() { + this(StatsigCredentialsUpdate.class); + } + + public StatsigCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public StatsigCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize StatsigAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (StatsigAPIKeyUpdate.class.equals(Integer.class) + || StatsigAPIKeyUpdate.class.equals(Long.class) + || StatsigAPIKeyUpdate.class.equals(Float.class) + || StatsigAPIKeyUpdate.class.equals(Double.class) + || StatsigAPIKeyUpdate.class.equals(Boolean.class) + || StatsigAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((StatsigAPIKeyUpdate.class.equals(Integer.class) + || StatsigAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((StatsigAPIKeyUpdate.class.equals(Float.class) + || StatsigAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (StatsigAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (StatsigAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(StatsigAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((StatsigAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'StatsigAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'StatsigAPIKeyUpdate'", e); + } + + StatsigCredentialsUpdate ret = new StatsigCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public StatsigCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "StatsigCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public StatsigCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public StatsigCredentialsUpdate(StatsigAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("StatsigAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(StatsigCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return StatsigCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: StatsigAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(StatsigAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be StatsigAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: StatsigAPIKeyUpdate + * + * @return The actual instance (StatsigAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `StatsigAPIKeyUpdate`. If the actual instance is not + * `StatsigAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `StatsigAPIKeyUpdate` + * @throws ClassCastException if the instance is not `StatsigAPIKeyUpdate` + */ + public StatsigAPIKeyUpdate getStatsigAPIKeyUpdate() throws ClassCastException { + return (StatsigAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigIntegration.java b/src/main/java/com/datadog/api/client/v2/model/StatsigIntegration.java new file mode 100644 index 00000000000..16a3b880602 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the StatsigIntegration object. */ +@JsonPropertyOrder({ + StatsigIntegration.JSON_PROPERTY_CREDENTIALS, + StatsigIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StatsigIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private StatsigCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private StatsigIntegrationType type; + + public StatsigIntegration() {} + + @JsonCreator + public StatsigIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + StatsigCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) StatsigIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public StatsigIntegration credentials(StatsigCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the StatsigCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatsigCredentials getCredentials() { + return credentials; + } + + public void setCredentials(StatsigCredentials credentials) { + this.credentials = credentials; + } + + public StatsigIntegration type(StatsigIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the StatsigIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatsigIntegrationType getType() { + return type; + } + + public void setType(StatsigIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return StatsigIntegration + */ + @JsonAnySetter + public StatsigIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this StatsigIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatsigIntegration statsigIntegration = (StatsigIntegration) o; + return Objects.equals(this.credentials, statsigIntegration.credentials) + && Objects.equals(this.type, statsigIntegration.type) + && Objects.equals(this.additionalProperties, statsigIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatsigIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/StatsigIntegrationType.java new file mode 100644 index 00000000000..bb31bb1a3dd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigIntegrationType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the StatsigIntegrationType object. */ +@JsonSerialize(using = StatsigIntegrationType.StatsigIntegrationTypeSerializer.class) +public class StatsigIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Statsig")); + + public static final StatsigIntegrationType STATSIG = new StatsigIntegrationType("Statsig"); + + StatsigIntegrationType(String value) { + super(value, allowedValues); + } + + public static class StatsigIntegrationTypeSerializer + extends StdSerializer { + public StatsigIntegrationTypeSerializer(Class t) { + super(t); + } + + public StatsigIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + StatsigIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static StatsigIntegrationType fromValue(String value) { + return new StatsigIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StatsigIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/StatsigIntegrationUpdate.java new file mode 100644 index 00000000000..dd9d3c817a4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StatsigIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the StatsigIntegrationUpdate object. */ +@JsonPropertyOrder({ + StatsigIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + StatsigIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StatsigIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private StatsigCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private StatsigIntegrationType type; + + public StatsigIntegrationUpdate() {} + + @JsonCreator + public StatsigIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) StatsigIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public StatsigIntegrationUpdate credentials(StatsigCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the StatsigCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatsigCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(StatsigCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public StatsigIntegrationUpdate type(StatsigIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the StatsigIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatsigIntegrationType getType() { + return type; + } + + public void setType(StatsigIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return StatsigIntegrationUpdate + */ + @JsonAnySetter + public StatsigIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this StatsigIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatsigIntegrationUpdate statsigIntegrationUpdate = (StatsigIntegrationUpdate) o; + return Objects.equals(this.credentials, statsigIntegrationUpdate.credentials) + && Objects.equals(this.type, statsigIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, statsigIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatsigIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKey.java new file mode 100644 index 00000000000..51c10f43c7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKey.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the VirusTotalAPIKey object. */ +@JsonPropertyOrder({VirusTotalAPIKey.JSON_PROPERTY_API_KEY, VirusTotalAPIKey.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class VirusTotalAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private VirusTotalAPIKeyType type; + + public VirusTotalAPIKey() {} + + @JsonCreator + public VirusTotalAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) VirusTotalAPIKeyType type) { + this.apiKey = apiKey; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public VirusTotalAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The VirusTotalAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public VirusTotalAPIKey type(VirusTotalAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the VirusTotalAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public VirusTotalAPIKeyType getType() { + return type; + } + + public void setType(VirusTotalAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return VirusTotalAPIKey + */ + @JsonAnySetter + public VirusTotalAPIKey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this VirusTotalAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VirusTotalAPIKey virusTotalApiKey = (VirusTotalAPIKey) o; + return Objects.equals(this.apiKey, virusTotalApiKey.apiKey) + && Objects.equals(this.type, virusTotalApiKey.type) + && Objects.equals(this.additionalProperties, virusTotalApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VirusTotalAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKeyType.java new file mode 100644 index 00000000000..31827e30bdd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKeyType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the VirusTotalAPIKey object. */ +@JsonSerialize(using = VirusTotalAPIKeyType.VirusTotalAPIKeyTypeSerializer.class) +public class VirusTotalAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("VirusTotalAPIKey")); + + public static final VirusTotalAPIKeyType VIRUSTOTALAPIKEY = + new VirusTotalAPIKeyType("VirusTotalAPIKey"); + + VirusTotalAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class VirusTotalAPIKeyTypeSerializer extends StdSerializer { + public VirusTotalAPIKeyTypeSerializer(Class t) { + super(t); + } + + public VirusTotalAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize( + VirusTotalAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static VirusTotalAPIKeyType fromValue(String value) { + return new VirusTotalAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKeyUpdate.java new file mode 100644 index 00000000000..9a10cd3af45 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalAPIKeyUpdate.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the VirusTotalAPIKey object. */ +@JsonPropertyOrder({ + VirusTotalAPIKeyUpdate.JSON_PROPERTY_API_KEY, + VirusTotalAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class VirusTotalAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_TYPE = "type"; + private VirusTotalAPIKeyType type; + + public VirusTotalAPIKeyUpdate() {} + + @JsonCreator + public VirusTotalAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) VirusTotalAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public VirusTotalAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The VirusTotalAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public VirusTotalAPIKeyUpdate type(VirusTotalAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the VirusTotalAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public VirusTotalAPIKeyType getType() { + return type; + } + + public void setType(VirusTotalAPIKeyType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return VirusTotalAPIKeyUpdate + */ + @JsonAnySetter + public VirusTotalAPIKeyUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this VirusTotalAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VirusTotalAPIKeyUpdate virusTotalApiKeyUpdate = (VirusTotalAPIKeyUpdate) o; + return Objects.equals(this.apiKey, virusTotalApiKeyUpdate.apiKey) + && Objects.equals(this.type, virusTotalApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, virusTotalApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VirusTotalAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalCredentials.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalCredentials.java new file mode 100644 index 00000000000..de3a4a915b7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalCredentials.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = VirusTotalCredentials.VirusTotalCredentialsDeserializer.class) +@JsonSerialize(using = VirusTotalCredentials.VirusTotalCredentialsSerializer.class) +public class VirusTotalCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(VirusTotalCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class VirusTotalCredentialsSerializer extends StdSerializer { + public VirusTotalCredentialsSerializer(Class t) { + super(t); + } + + public VirusTotalCredentialsSerializer() { + this(null); + } + + @Override + public void serialize( + VirusTotalCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class VirusTotalCredentialsDeserializer + extends StdDeserializer { + public VirusTotalCredentialsDeserializer() { + this(VirusTotalCredentials.class); + } + + public VirusTotalCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public VirusTotalCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize VirusTotalAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VirusTotalAPIKey.class.equals(Integer.class) + || VirusTotalAPIKey.class.equals(Long.class) + || VirusTotalAPIKey.class.equals(Float.class) + || VirusTotalAPIKey.class.equals(Double.class) + || VirusTotalAPIKey.class.equals(Boolean.class) + || VirusTotalAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VirusTotalAPIKey.class.equals(Integer.class) + || VirusTotalAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VirusTotalAPIKey.class.equals(Float.class) + || VirusTotalAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (VirusTotalAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VirusTotalAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(VirusTotalAPIKey.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((VirusTotalAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'VirusTotalAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'VirusTotalAPIKey'", e); + } + + VirusTotalCredentials ret = new VirusTotalCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public VirusTotalCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "VirusTotalCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public VirusTotalCredentials() { + super("oneOf", Boolean.FALSE); + } + + public VirusTotalCredentials(VirusTotalAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("VirusTotalAPIKey", new GenericType() {}); + JSON.registerDescendants(VirusTotalCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return VirusTotalCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: VirusTotalAPIKey + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(VirusTotalAPIKey.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be VirusTotalAPIKey"); + } + + /** + * Get the actual instance, which can be the following: VirusTotalAPIKey + * + * @return The actual instance (VirusTotalAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `VirusTotalAPIKey`. If the actual instance is not + * `VirusTotalAPIKey`, the ClassCastException will be thrown. + * + * @return The actual instance of `VirusTotalAPIKey` + * @throws ClassCastException if the instance is not `VirusTotalAPIKey` + */ + public VirusTotalAPIKey getVirusTotalAPIKey() throws ClassCastException { + return (VirusTotalAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalCredentialsUpdate.java new file mode 100644 index 00000000000..235dfd94772 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalCredentialsUpdate.java @@ -0,0 +1,215 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = VirusTotalCredentialsUpdate.VirusTotalCredentialsUpdateDeserializer.class) +@JsonSerialize(using = VirusTotalCredentialsUpdate.VirusTotalCredentialsUpdateSerializer.class) +public class VirusTotalCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(VirusTotalCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class VirusTotalCredentialsUpdateSerializer + extends StdSerializer { + public VirusTotalCredentialsUpdateSerializer(Class t) { + super(t); + } + + public VirusTotalCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + VirusTotalCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class VirusTotalCredentialsUpdateDeserializer + extends StdDeserializer { + public VirusTotalCredentialsUpdateDeserializer() { + this(VirusTotalCredentialsUpdate.class); + } + + public VirusTotalCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public VirusTotalCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize VirusTotalAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VirusTotalAPIKeyUpdate.class.equals(Integer.class) + || VirusTotalAPIKeyUpdate.class.equals(Long.class) + || VirusTotalAPIKeyUpdate.class.equals(Float.class) + || VirusTotalAPIKeyUpdate.class.equals(Double.class) + || VirusTotalAPIKeyUpdate.class.equals(Boolean.class) + || VirusTotalAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VirusTotalAPIKeyUpdate.class.equals(Integer.class) + || VirusTotalAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VirusTotalAPIKeyUpdate.class.equals(Float.class) + || VirusTotalAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (VirusTotalAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VirusTotalAPIKeyUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(VirusTotalAPIKeyUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((VirusTotalAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'VirusTotalAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'VirusTotalAPIKeyUpdate'", e); + } + + VirusTotalCredentialsUpdate ret = new VirusTotalCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public VirusTotalCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "VirusTotalCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public VirusTotalCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public VirusTotalCredentialsUpdate(VirusTotalAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("VirusTotalAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants( + VirusTotalCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return VirusTotalCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: VirusTotalAPIKeyUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(VirusTotalAPIKeyUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be VirusTotalAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: VirusTotalAPIKeyUpdate + * + * @return The actual instance (VirusTotalAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `VirusTotalAPIKeyUpdate`. If the actual instance is not + * `VirusTotalAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `VirusTotalAPIKeyUpdate` + * @throws ClassCastException if the instance is not `VirusTotalAPIKeyUpdate` + */ + public VirusTotalAPIKeyUpdate getVirusTotalAPIKeyUpdate() throws ClassCastException { + return (VirusTotalAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegration.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegration.java new file mode 100644 index 00000000000..8d1cb0e263c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegration.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the VirusTotalIntegration object. */ +@JsonPropertyOrder({ + VirusTotalIntegration.JSON_PROPERTY_CREDENTIALS, + VirusTotalIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class VirusTotalIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private VirusTotalCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private VirusTotalIntegrationType type; + + public VirusTotalIntegration() {} + + @JsonCreator + public VirusTotalIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + VirusTotalCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) VirusTotalIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public VirusTotalIntegration credentials(VirusTotalCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the VirusTotalCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public VirusTotalCredentials getCredentials() { + return credentials; + } + + public void setCredentials(VirusTotalCredentials credentials) { + this.credentials = credentials; + } + + public VirusTotalIntegration type(VirusTotalIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the VirusTotalIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public VirusTotalIntegrationType getType() { + return type; + } + + public void setType(VirusTotalIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return VirusTotalIntegration + */ + @JsonAnySetter + public VirusTotalIntegration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this VirusTotalIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VirusTotalIntegration virusTotalIntegration = (VirusTotalIntegration) o; + return Objects.equals(this.credentials, virusTotalIntegration.credentials) + && Objects.equals(this.type, virusTotalIntegration.type) + && Objects.equals(this.additionalProperties, virusTotalIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VirusTotalIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegrationType.java new file mode 100644 index 00000000000..42d834ae840 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegrationType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of the VirusTotalIntegrationType object. */ +@JsonSerialize(using = VirusTotalIntegrationType.VirusTotalIntegrationTypeSerializer.class) +public class VirusTotalIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("VirusTotal")); + + public static final VirusTotalIntegrationType VIRUSTOTAL = + new VirusTotalIntegrationType("VirusTotal"); + + VirusTotalIntegrationType(String value) { + super(value, allowedValues); + } + + public static class VirusTotalIntegrationTypeSerializer + extends StdSerializer { + public VirusTotalIntegrationTypeSerializer(Class t) { + super(t); + } + + public VirusTotalIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + VirusTotalIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static VirusTotalIntegrationType fromValue(String value) { + return new VirusTotalIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegrationUpdate.java new file mode 100644 index 00000000000..9bd1f22351b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VirusTotalIntegrationUpdate.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the VirusTotalIntegrationUpdate object. */ +@JsonPropertyOrder({ + VirusTotalIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + VirusTotalIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class VirusTotalIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private VirusTotalCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private VirusTotalIntegrationType type; + + public VirusTotalIntegrationUpdate() {} + + @JsonCreator + public VirusTotalIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) VirusTotalIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public VirusTotalIntegrationUpdate credentials(VirusTotalCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the VirusTotalCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public VirusTotalCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(VirusTotalCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public VirusTotalIntegrationUpdate type(VirusTotalIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the VirusTotalIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public VirusTotalIntegrationType getType() { + return type; + } + + public void setType(VirusTotalIntegrationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return VirusTotalIntegrationUpdate + */ + @JsonAnySetter + public VirusTotalIntegrationUpdate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this VirusTotalIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VirusTotalIntegrationUpdate virusTotalIntegrationUpdate = (VirusTotalIntegrationUpdate) o; + return Objects.equals(this.credentials, virusTotalIntegrationUpdate.credentials) + && Objects.equals(this.type, virusTotalIntegrationUpdate.type) + && Objects.equals( + this.additionalProperties, virusTotalIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VirusTotalIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +}