diff --git a/.generated-info b/.generated-info index 7d31455ea..aee8a4dc5 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "b75095c", - "generated": "2025-07-31 10:50:58.895" + "spec_repo_commit": "356ca3c", + "generated": "2025-07-31 15:24:59.563" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b125b71c6..9e86624ab 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/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 681c57aa6..baa48cb79 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -36,6 +36,80 @@ pub mod model_aws_credentials; pub use self::model_aws_credentials::AWSCredentials; pub mod model_aws_integration_type; pub use self::model_aws_integration_type::AWSIntegrationType; +pub mod model_anthropic_integration; +pub use self::model_anthropic_integration::AnthropicIntegration; +pub mod model_anthropic_api_key; +pub use self::model_anthropic_api_key::AnthropicAPIKey; +pub mod model_anthropic_api_key_type; +pub use self::model_anthropic_api_key_type::AnthropicAPIKeyType; +pub mod model_anthropic_credentials; +pub use self::model_anthropic_credentials::AnthropicCredentials; +pub mod model_anthropic_integration_type; +pub use self::model_anthropic_integration_type::AnthropicIntegrationType; +pub mod model_asana_integration; +pub use self::model_asana_integration::AsanaIntegration; +pub mod model_asana_access_token; +pub use self::model_asana_access_token::AsanaAccessToken; +pub mod model_asana_access_token_type; +pub use self::model_asana_access_token_type::AsanaAccessTokenType; +pub mod model_asana_credentials; +pub use self::model_asana_credentials::AsanaCredentials; +pub mod model_asana_integration_type; +pub use self::model_asana_integration_type::AsanaIntegrationType; +pub mod model_azure_integration; +pub use self::model_azure_integration::AzureIntegration; +pub mod model_azure_tenant; +pub use self::model_azure_tenant::AzureTenant; +pub mod model_azure_tenant_type; +pub use self::model_azure_tenant_type::AzureTenantType; +pub mod model_azure_credentials; +pub use self::model_azure_credentials::AzureCredentials; +pub mod model_azure_integration_type; +pub use self::model_azure_integration_type::AzureIntegrationType; +pub mod model_circle_ci_integration; +pub use self::model_circle_ci_integration::CircleCIIntegration; +pub mod model_circle_ciapi_key; +pub use self::model_circle_ciapi_key::CircleCIAPIKey; +pub mod model_circle_ciapi_key_type; +pub use self::model_circle_ciapi_key_type::CircleCIAPIKeyType; +pub mod model_circle_ci_credentials; +pub use self::model_circle_ci_credentials::CircleCICredentials; +pub mod model_circle_ci_integration_type; +pub use self::model_circle_ci_integration_type::CircleCIIntegrationType; +pub mod model_clickup_integration; +pub use self::model_clickup_integration::ClickupIntegration; +pub mod model_clickup_api_key; +pub use self::model_clickup_api_key::ClickupAPIKey; +pub mod model_clickup_api_key_type; +pub use self::model_clickup_api_key_type::ClickupAPIKeyType; +pub mod model_clickup_credentials; +pub use self::model_clickup_credentials::ClickupCredentials; +pub mod model_clickup_integration_type; +pub use self::model_clickup_integration_type::ClickupIntegrationType; +pub mod model_cloudflare_integration; +pub use self::model_cloudflare_integration::CloudflareIntegration; +pub mod model_cloudflare_api_token; +pub use self::model_cloudflare_api_token::CloudflareAPIToken; +pub mod model_cloudflare_api_token_type; +pub use self::model_cloudflare_api_token_type::CloudflareAPITokenType; +pub mod model_cloudflare_global_api_token; +pub use self::model_cloudflare_global_api_token::CloudflareGlobalAPIToken; +pub mod model_cloudflare_global_api_token_type; +pub use self::model_cloudflare_global_api_token_type::CloudflareGlobalAPITokenType; +pub mod model_cloudflare_credentials; +pub use self::model_cloudflare_credentials::CloudflareCredentials; +pub mod model_cloudflare_integration_type; +pub use self::model_cloudflare_integration_type::CloudflareIntegrationType; +pub mod model_config_cat_integration; +pub use self::model_config_cat_integration::ConfigCatIntegration; +pub mod model_config_cat_sdk_key; +pub use self::model_config_cat_sdk_key::ConfigCatSDKKey; +pub mod model_config_cat_sdk_key_type; +pub use self::model_config_cat_sdk_key_type::ConfigCatSDKKeyType; +pub mod model_config_cat_credentials; +pub use self::model_config_cat_credentials::ConfigCatCredentials; +pub mod model_config_cat_integration_type; +pub use self::model_config_cat_integration_type::ConfigCatIntegrationType; pub mod model_datadog_integration; pub use self::model_datadog_integration::DatadogIntegration; pub mod model_datadog_api_key; @@ -46,6 +120,66 @@ pub mod model_datadog_credentials; pub use self::model_datadog_credentials::DatadogCredentials; pub mod model_datadog_integration_type; pub use self::model_datadog_integration_type::DatadogIntegrationType; +pub mod model_fastly_integration; +pub use self::model_fastly_integration::FastlyIntegration; +pub mod model_fastly_api_key; +pub use self::model_fastly_api_key::FastlyAPIKey; +pub mod model_fastly_api_key_type; +pub use self::model_fastly_api_key_type::FastlyAPIKeyType; +pub mod model_fastly_credentials; +pub use self::model_fastly_credentials::FastlyCredentials; +pub mod model_fastly_integration_type; +pub use self::model_fastly_integration_type::FastlyIntegrationType; +pub mod model_freshservice_integration; +pub use self::model_freshservice_integration::FreshserviceIntegration; +pub mod model_freshservice_api_key; +pub use self::model_freshservice_api_key::FreshserviceAPIKey; +pub mod model_freshservice_api_key_type; +pub use self::model_freshservice_api_key_type::FreshserviceAPIKeyType; +pub mod model_freshservice_credentials; +pub use self::model_freshservice_credentials::FreshserviceCredentials; +pub mod model_freshservice_integration_type; +pub use self::model_freshservice_integration_type::FreshserviceIntegrationType; +pub mod model_gcp_integration; +pub use self::model_gcp_integration::GCPIntegration; +pub mod model_gcp_service_account; +pub use self::model_gcp_service_account::GCPServiceAccount; +pub mod model_gcp_service_account_credential_type; +pub use self::model_gcp_service_account_credential_type::GCPServiceAccountCredentialType; +pub mod model_gcp_credentials; +pub use self::model_gcp_credentials::GCPCredentials; +pub mod model_gcp_integration_type; +pub use self::model_gcp_integration_type::GCPIntegrationType; +pub mod model_gemini_integration; +pub use self::model_gemini_integration::GeminiIntegration; +pub mod model_gemini_api_key; +pub use self::model_gemini_api_key::GeminiAPIKey; +pub mod model_gemini_api_key_type; +pub use self::model_gemini_api_key_type::GeminiAPIKeyType; +pub mod model_gemini_credentials; +pub use self::model_gemini_credentials::GeminiCredentials; +pub mod model_gemini_integration_type; +pub use self::model_gemini_integration_type::GeminiIntegrationType; +pub mod model_gitlab_integration; +pub use self::model_gitlab_integration::GitlabIntegration; +pub mod model_gitlab_api_key; +pub use self::model_gitlab_api_key::GitlabAPIKey; +pub mod model_gitlab_api_key_type; +pub use self::model_gitlab_api_key_type::GitlabAPIKeyType; +pub mod model_gitlab_credentials; +pub use self::model_gitlab_credentials::GitlabCredentials; +pub mod model_gitlab_integration_type; +pub use self::model_gitlab_integration_type::GitlabIntegrationType; +pub mod model_grey_noise_integration; +pub use self::model_grey_noise_integration::GreyNoiseIntegration; +pub mod model_grey_noise_api_key; +pub use self::model_grey_noise_api_key::GreyNoiseAPIKey; +pub mod model_grey_noise_api_key_type; +pub use self::model_grey_noise_api_key_type::GreyNoiseAPIKeyType; +pub mod model_grey_noise_credentials; +pub use self::model_grey_noise_credentials::GreyNoiseCredentials; +pub mod model_grey_noise_integration_type; +pub use self::model_grey_noise_integration_type::GreyNoiseIntegrationType; pub mod model_http_integration; pub use self::model_http_integration::HTTPIntegration; pub mod model_http_token_auth; @@ -66,6 +200,86 @@ pub mod model_http_credentials; pub use self::model_http_credentials::HTTPCredentials; pub mod model_http_integration_type; pub use self::model_http_integration_type::HTTPIntegrationType; +pub mod model_launch_darkly_integration; +pub use self::model_launch_darkly_integration::LaunchDarklyIntegration; +pub mod model_launch_darkly_api_key; +pub use self::model_launch_darkly_api_key::LaunchDarklyAPIKey; +pub mod model_launch_darkly_api_key_type; +pub use self::model_launch_darkly_api_key_type::LaunchDarklyAPIKeyType; +pub mod model_launch_darkly_credentials; +pub use self::model_launch_darkly_credentials::LaunchDarklyCredentials; +pub mod model_launch_darkly_integration_type; +pub use self::model_launch_darkly_integration_type::LaunchDarklyIntegrationType; +pub mod model_notion_integration; +pub use self::model_notion_integration::NotionIntegration; +pub mod model_notion_api_key; +pub use self::model_notion_api_key::NotionAPIKey; +pub mod model_notion_api_key_type; +pub use self::model_notion_api_key_type::NotionAPIKeyType; +pub mod model_notion_credentials; +pub use self::model_notion_credentials::NotionCredentials; +pub mod model_notion_integration_type; +pub use self::model_notion_integration_type::NotionIntegrationType; +pub mod model_okta_integration; +pub use self::model_okta_integration::OktaIntegration; +pub mod model_okta_api_token; +pub use self::model_okta_api_token::OktaAPIToken; +pub mod model_okta_api_token_type; +pub use self::model_okta_api_token_type::OktaAPITokenType; +pub mod model_okta_credentials; +pub use self::model_okta_credentials::OktaCredentials; +pub mod model_okta_integration_type; +pub use self::model_okta_integration_type::OktaIntegrationType; +pub mod model_open_ai_integration; +pub use self::model_open_ai_integration::OpenAIIntegration; +pub mod model_open_aiapi_key; +pub use self::model_open_aiapi_key::OpenAIAPIKey; +pub mod model_open_aiapi_key_type; +pub use self::model_open_aiapi_key_type::OpenAIAPIKeyType; +pub mod model_open_ai_credentials; +pub use self::model_open_ai_credentials::OpenAICredentials; +pub mod model_open_ai_integration_type; +pub use self::model_open_ai_integration_type::OpenAIIntegrationType; +pub mod model_service_now_integration; +pub use self::model_service_now_integration::ServiceNowIntegration; +pub mod model_service_now_basic_auth; +pub use self::model_service_now_basic_auth::ServiceNowBasicAuth; +pub mod model_service_now_basic_auth_type; +pub use self::model_service_now_basic_auth_type::ServiceNowBasicAuthType; +pub mod model_service_now_credentials; +pub use self::model_service_now_credentials::ServiceNowCredentials; +pub mod model_service_now_integration_type; +pub use self::model_service_now_integration_type::ServiceNowIntegrationType; +pub mod model_split_integration; +pub use self::model_split_integration::SplitIntegration; +pub mod model_split_api_key; +pub use self::model_split_api_key::SplitAPIKey; +pub mod model_split_api_key_type; +pub use self::model_split_api_key_type::SplitAPIKeyType; +pub mod model_split_credentials; +pub use self::model_split_credentials::SplitCredentials; +pub mod model_split_integration_type; +pub use self::model_split_integration_type::SplitIntegrationType; +pub mod model_statsig_integration; +pub use self::model_statsig_integration::StatsigIntegration; +pub mod model_statsig_api_key; +pub use self::model_statsig_api_key::StatsigAPIKey; +pub mod model_statsig_api_key_type; +pub use self::model_statsig_api_key_type::StatsigAPIKeyType; +pub mod model_statsig_credentials; +pub use self::model_statsig_credentials::StatsigCredentials; +pub mod model_statsig_integration_type; +pub use self::model_statsig_integration_type::StatsigIntegrationType; +pub mod model_virus_total_integration; +pub use self::model_virus_total_integration::VirusTotalIntegration; +pub mod model_virus_total_api_key; +pub use self::model_virus_total_api_key::VirusTotalAPIKey; +pub mod model_virus_total_api_key_type; +pub use self::model_virus_total_api_key_type::VirusTotalAPIKeyType; +pub mod model_virus_total_credentials; +pub use self::model_virus_total_credentials::VirusTotalCredentials; +pub mod model_virus_total_integration_type; +pub use self::model_virus_total_integration_type::VirusTotalIntegrationType; pub mod model_action_connection_integration; pub use self::model_action_connection_integration::ActionConnectionIntegration; pub mod model_action_connection_data_type; @@ -86,12 +300,92 @@ pub mod model_aws_assume_role_update; pub use self::model_aws_assume_role_update::AWSAssumeRoleUpdate; pub mod model_aws_credentials_update; pub use self::model_aws_credentials_update::AWSCredentialsUpdate; +pub mod model_anthropic_integration_update; +pub use self::model_anthropic_integration_update::AnthropicIntegrationUpdate; +pub mod model_anthropic_api_key_update; +pub use self::model_anthropic_api_key_update::AnthropicAPIKeyUpdate; +pub mod model_anthropic_credentials_update; +pub use self::model_anthropic_credentials_update::AnthropicCredentialsUpdate; +pub mod model_asana_integration_update; +pub use self::model_asana_integration_update::AsanaIntegrationUpdate; +pub mod model_asana_access_token_update; +pub use self::model_asana_access_token_update::AsanaAccessTokenUpdate; +pub mod model_asana_credentials_update; +pub use self::model_asana_credentials_update::AsanaCredentialsUpdate; +pub mod model_azure_integration_update; +pub use self::model_azure_integration_update::AzureIntegrationUpdate; +pub mod model_azure_tenant_update; +pub use self::model_azure_tenant_update::AzureTenantUpdate; +pub mod model_azure_credentials_update; +pub use self::model_azure_credentials_update::AzureCredentialsUpdate; +pub mod model_circle_ci_integration_update; +pub use self::model_circle_ci_integration_update::CircleCIIntegrationUpdate; +pub mod model_circle_ciapi_key_update; +pub use self::model_circle_ciapi_key_update::CircleCIAPIKeyUpdate; +pub mod model_circle_ci_credentials_update; +pub use self::model_circle_ci_credentials_update::CircleCICredentialsUpdate; +pub mod model_clickup_integration_update; +pub use self::model_clickup_integration_update::ClickupIntegrationUpdate; +pub mod model_clickup_api_key_update; +pub use self::model_clickup_api_key_update::ClickupAPIKeyUpdate; +pub mod model_clickup_credentials_update; +pub use self::model_clickup_credentials_update::ClickupCredentialsUpdate; +pub mod model_cloudflare_integration_update; +pub use self::model_cloudflare_integration_update::CloudflareIntegrationUpdate; +pub mod model_cloudflare_api_token_update; +pub use self::model_cloudflare_api_token_update::CloudflareAPITokenUpdate; +pub mod model_cloudflare_global_api_token_update; +pub use self::model_cloudflare_global_api_token_update::CloudflareGlobalAPITokenUpdate; +pub mod model_cloudflare_credentials_update; +pub use self::model_cloudflare_credentials_update::CloudflareCredentialsUpdate; +pub mod model_config_cat_integration_update; +pub use self::model_config_cat_integration_update::ConfigCatIntegrationUpdate; +pub mod model_config_cat_sdk_key_update; +pub use self::model_config_cat_sdk_key_update::ConfigCatSDKKeyUpdate; +pub mod model_config_cat_credentials_update; +pub use self::model_config_cat_credentials_update::ConfigCatCredentialsUpdate; pub mod model_datadog_integration_update; pub use self::model_datadog_integration_update::DatadogIntegrationUpdate; pub mod model_datadog_api_key_update; pub use self::model_datadog_api_key_update::DatadogAPIKeyUpdate; pub mod model_datadog_credentials_update; pub use self::model_datadog_credentials_update::DatadogCredentialsUpdate; +pub mod model_fastly_integration_update; +pub use self::model_fastly_integration_update::FastlyIntegrationUpdate; +pub mod model_fastly_api_key_update; +pub use self::model_fastly_api_key_update::FastlyAPIKeyUpdate; +pub mod model_fastly_credentials_update; +pub use self::model_fastly_credentials_update::FastlyCredentialsUpdate; +pub mod model_freshservice_integration_update; +pub use self::model_freshservice_integration_update::FreshserviceIntegrationUpdate; +pub mod model_freshservice_api_key_update; +pub use self::model_freshservice_api_key_update::FreshserviceAPIKeyUpdate; +pub mod model_freshservice_credentials_update; +pub use self::model_freshservice_credentials_update::FreshserviceCredentialsUpdate; +pub mod model_gcp_integration_update; +pub use self::model_gcp_integration_update::GCPIntegrationUpdate; +pub mod model_gcp_service_account_update; +pub use self::model_gcp_service_account_update::GCPServiceAccountUpdate; +pub mod model_gcp_credentials_update; +pub use self::model_gcp_credentials_update::GCPCredentialsUpdate; +pub mod model_gemini_integration_update; +pub use self::model_gemini_integration_update::GeminiIntegrationUpdate; +pub mod model_gemini_api_key_update; +pub use self::model_gemini_api_key_update::GeminiAPIKeyUpdate; +pub mod model_gemini_credentials_update; +pub use self::model_gemini_credentials_update::GeminiCredentialsUpdate; +pub mod model_gitlab_integration_update; +pub use self::model_gitlab_integration_update::GitlabIntegrationUpdate; +pub mod model_gitlab_api_key_update; +pub use self::model_gitlab_api_key_update::GitlabAPIKeyUpdate; +pub mod model_gitlab_credentials_update; +pub use self::model_gitlab_credentials_update::GitlabCredentialsUpdate; +pub mod model_grey_noise_integration_update; +pub use self::model_grey_noise_integration_update::GreyNoiseIntegrationUpdate; +pub mod model_grey_noise_api_key_update; +pub use self::model_grey_noise_api_key_update::GreyNoiseAPIKeyUpdate; +pub mod model_grey_noise_credentials_update; +pub use self::model_grey_noise_credentials_update::GreyNoiseCredentialsUpdate; pub mod model_http_integration_update; pub use self::model_http_integration_update::HTTPIntegrationUpdate; pub mod model_http_token_auth_update; @@ -104,6 +398,54 @@ pub mod model_url_param_update; pub use self::model_url_param_update::UrlParamUpdate; pub mod model_http_credentials_update; pub use self::model_http_credentials_update::HTTPCredentialsUpdate; +pub mod model_launch_darkly_integration_update; +pub use self::model_launch_darkly_integration_update::LaunchDarklyIntegrationUpdate; +pub mod model_launch_darkly_api_key_update; +pub use self::model_launch_darkly_api_key_update::LaunchDarklyAPIKeyUpdate; +pub mod model_launch_darkly_credentials_update; +pub use self::model_launch_darkly_credentials_update::LaunchDarklyCredentialsUpdate; +pub mod model_notion_integration_update; +pub use self::model_notion_integration_update::NotionIntegrationUpdate; +pub mod model_notion_api_key_update; +pub use self::model_notion_api_key_update::NotionAPIKeyUpdate; +pub mod model_notion_credentials_update; +pub use self::model_notion_credentials_update::NotionCredentialsUpdate; +pub mod model_okta_integration_update; +pub use self::model_okta_integration_update::OktaIntegrationUpdate; +pub mod model_okta_api_token_update; +pub use self::model_okta_api_token_update::OktaAPITokenUpdate; +pub mod model_okta_credentials_update; +pub use self::model_okta_credentials_update::OktaCredentialsUpdate; +pub mod model_open_ai_integration_update; +pub use self::model_open_ai_integration_update::OpenAIIntegrationUpdate; +pub mod model_open_aiapi_key_update; +pub use self::model_open_aiapi_key_update::OpenAIAPIKeyUpdate; +pub mod model_open_ai_credentials_update; +pub use self::model_open_ai_credentials_update::OpenAICredentialsUpdate; +pub mod model_service_now_integration_update; +pub use self::model_service_now_integration_update::ServiceNowIntegrationUpdate; +pub mod model_service_now_basic_auth_update; +pub use self::model_service_now_basic_auth_update::ServiceNowBasicAuthUpdate; +pub mod model_service_now_credentials_update; +pub use self::model_service_now_credentials_update::ServiceNowCredentialsUpdate; +pub mod model_split_integration_update; +pub use self::model_split_integration_update::SplitIntegrationUpdate; +pub mod model_split_api_key_update; +pub use self::model_split_api_key_update::SplitAPIKeyUpdate; +pub mod model_split_credentials_update; +pub use self::model_split_credentials_update::SplitCredentialsUpdate; +pub mod model_statsig_integration_update; +pub use self::model_statsig_integration_update::StatsigIntegrationUpdate; +pub mod model_statsig_api_key_update; +pub use self::model_statsig_api_key_update::StatsigAPIKeyUpdate; +pub mod model_statsig_credentials_update; +pub use self::model_statsig_credentials_update::StatsigCredentialsUpdate; +pub mod model_virus_total_integration_update; +pub use self::model_virus_total_integration_update::VirusTotalIntegrationUpdate; +pub mod model_virus_total_api_key_update; +pub use self::model_virus_total_api_key_update::VirusTotalAPIKeyUpdate; +pub mod model_virus_total_credentials_update; +pub use self::model_virus_total_credentials_update::VirusTotalCredentialsUpdate; pub mod model_action_connection_integration_update; pub use self::model_action_connection_integration_update::ActionConnectionIntegrationUpdate; pub mod model_update_action_connection_response; diff --git a/src/datadogV2/model/model_action_connection_integration.rs b/src/datadogV2/model/model_action_connection_integration.rs index c6ca62f47..7402a53ba 100644 --- a/src/datadogV2/model/model_action_connection_integration.rs +++ b/src/datadogV2/model/model_action_connection_integration.rs @@ -9,8 +9,29 @@ use serde::{Deserialize, Deserializer, Serialize}; #[serde(untagged)] pub enum ActionConnectionIntegration { AWSIntegration(Box), + AnthropicIntegration(Box), + AsanaIntegration(Box), + AzureIntegration(Box), + CircleCIIntegration(Box), + ClickupIntegration(Box), + CloudflareIntegration(Box), + ConfigCatIntegration(Box), DatadogIntegration(Box), + FastlyIntegration(Box), + FreshserviceIntegration(Box), + GCPIntegration(Box), + GeminiIntegration(Box), + GitlabIntegration(Box), + GreyNoiseIntegration(Box), HTTPIntegration(Box), + LaunchDarklyIntegration(Box), + NotionIntegration(Box), + OktaIntegration(Box), + OpenAIIntegration(Box), + ServiceNowIntegration(Box), + SplitIntegration(Box), + StatsigIntegration(Box), + VirusTotalIntegration(Box), UnparsedObject(crate::datadog::UnparsedObject), } @@ -27,6 +48,55 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegration { return Ok(ActionConnectionIntegration::AWSIntegration(_v)); } } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::AnthropicIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::AsanaIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::AzureIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::CircleCIIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::ClickupIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::CloudflareIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::ConfigCatIntegration(_v)); + } + } if let Ok(_v) = serde_json::from_value::>( value.clone(), ) { @@ -34,6 +104,49 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegration { return Ok(ActionConnectionIntegration::DatadogIntegration(_v)); } } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::FastlyIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::FreshserviceIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::GCPIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::GeminiIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::GitlabIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::GreyNoiseIntegration(_v)); + } + } if let Ok(_v) = serde_json::from_value::>(value.clone()) { @@ -41,6 +154,63 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegration { return Ok(ActionConnectionIntegration::HTTPIntegration(_v)); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::LaunchDarklyIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::NotionIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::OktaIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::OpenAIIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::ServiceNowIntegration(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::SplitIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::StatsigIntegration(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegration::VirusTotalIntegration(_v)); + } + } return Ok(ActionConnectionIntegration::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_action_connection_integration_update.rs b/src/datadogV2/model/model_action_connection_integration_update.rs index dc27b7523..6eef476de 100644 --- a/src/datadogV2/model/model_action_connection_integration_update.rs +++ b/src/datadogV2/model/model_action_connection_integration_update.rs @@ -9,8 +9,29 @@ use serde::{Deserialize, Deserializer, Serialize}; #[serde(untagged)] pub enum ActionConnectionIntegrationUpdate { AWSIntegrationUpdate(Box), + AnthropicIntegrationUpdate(Box), + AsanaIntegrationUpdate(Box), + AzureIntegrationUpdate(Box), + CircleCIIntegrationUpdate(Box), + ClickupIntegrationUpdate(Box), + CloudflareIntegrationUpdate(Box), + ConfigCatIntegrationUpdate(Box), DatadogIntegrationUpdate(Box), + FastlyIntegrationUpdate(Box), + FreshserviceIntegrationUpdate(Box), + GCPIntegrationUpdate(Box), + GeminiIntegrationUpdate(Box), + GitlabIntegrationUpdate(Box), + GreyNoiseIntegrationUpdate(Box), HTTPIntegrationUpdate(Box), + LaunchDarklyIntegrationUpdate(Box), + NotionIntegrationUpdate(Box), + OktaIntegrationUpdate(Box), + OpenAIIntegrationUpdate(Box), + ServiceNowIntegrationUpdate(Box), + SplitIntegrationUpdate(Box), + StatsigIntegrationUpdate(Box), + VirusTotalIntegrationUpdate(Box), UnparsedObject(crate::datadog::UnparsedObject), } @@ -27,6 +48,66 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegrationUpdate { return Ok(ActionConnectionIntegrationUpdate::AWSIntegrationUpdate(_v)); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::AnthropicIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::AsanaIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::AzureIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::CircleCIIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::ClickupIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::CloudflareIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::ConfigCatIntegrationUpdate(_v)); + } + } if let Ok(_v) = serde_json::from_value::< Box, >(value.clone()) @@ -37,6 +118,59 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegrationUpdate { )); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::FastlyIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::FreshserviceIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::GCPIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::GeminiIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::GitlabIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::GreyNoiseIntegrationUpdate(_v)); + } + } if let Ok(_v) = serde_json::from_value::>( value.clone(), ) { @@ -44,6 +178,76 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegrationUpdate { return Ok(ActionConnectionIntegrationUpdate::HTTPIntegrationUpdate(_v)); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::LaunchDarklyIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::NotionIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::OktaIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::OpenAIIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::ServiceNowIntegrationUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::SplitIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::StatsigIntegrationUpdate( + _v, + )); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ActionConnectionIntegrationUpdate::VirusTotalIntegrationUpdate(_v)); + } + } return Ok(ActionConnectionIntegrationUpdate::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_anthropic_api_key.rs b/src/datadogV2/model/model_anthropic_api_key.rs new file mode 100644 index 000000000..dc076394a --- /dev/null +++ b/src/datadogV2/model/model_anthropic_api_key.rs @@ -0,0 +1,113 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AnthropicAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AnthropicAPIKey { + /// The `AnthropicAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `AnthropicAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AnthropicAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AnthropicAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::AnthropicAPIKeyType, + ) -> AnthropicAPIKey { + AnthropicAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AnthropicAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AnthropicAPIKeyVisitor; + impl<'a> Visitor<'a> for AnthropicAPIKeyVisitor { + type Value = AnthropicAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AnthropicAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AnthropicAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AnthropicAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_anthropic_api_key_type.rs b/src/datadogV2/model/model_anthropic_api_key_type.rs new file mode 100644 index 000000000..2ace92122 --- /dev/null +++ b/src/datadogV2/model/model_anthropic_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AnthropicAPIKeyType { + ANTHROPICAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AnthropicAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::ANTHROPICAPIKEY => String::from("AnthropicAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AnthropicAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AnthropicAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "AnthropicAPIKey" => Self::ANTHROPICAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_anthropic_api_key_update.rs b/src/datadogV2/model/model_anthropic_api_key_update.rs new file mode 100644 index 000000000..ca638b65a --- /dev/null +++ b/src/datadogV2/model/model_anthropic_api_key_update.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AnthropicAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AnthropicAPIKeyUpdate { + /// The `AnthropicAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `AnthropicAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AnthropicAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AnthropicAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::AnthropicAPIKeyType) -> AnthropicAPIKeyUpdate { + AnthropicAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AnthropicAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AnthropicAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for AnthropicAPIKeyUpdateVisitor { + type Value = AnthropicAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AnthropicAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AnthropicAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AnthropicAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_anthropic_credentials.rs b/src/datadogV2/model/model_anthropic_credentials.rs new file mode 100644 index 000000000..4177b891e --- /dev/null +++ b/src/datadogV2/model/model_anthropic_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `AnthropicCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AnthropicCredentials { + AnthropicAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AnthropicCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(AnthropicCredentials::AnthropicAPIKey(_v)); + } + } + + return Ok(AnthropicCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_anthropic_credentials_update.rs b/src/datadogV2/model/model_anthropic_credentials_update.rs new file mode 100644 index 000000000..f18153a5b --- /dev/null +++ b/src/datadogV2/model/model_anthropic_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `AnthropicCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AnthropicCredentialsUpdate { + AnthropicAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AnthropicCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(AnthropicCredentialsUpdate::AnthropicAPIKeyUpdate(_v)); + } + } + + return Ok(AnthropicCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_anthropic_integration.rs b/src/datadogV2/model/model_anthropic_integration.rs new file mode 100644 index 000000000..b0e796277 --- /dev/null +++ b/src/datadogV2/model/model_anthropic_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AnthropicIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AnthropicIntegration { + /// The definition of the `AnthropicCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::AnthropicCredentials, + /// The definition of the `AnthropicIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AnthropicIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AnthropicIntegration { + pub fn new( + credentials: crate::datadogV2::model::AnthropicCredentials, + type_: crate::datadogV2::model::AnthropicIntegrationType, + ) -> AnthropicIntegration { + AnthropicIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AnthropicIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AnthropicIntegrationVisitor; + impl<'a> Visitor<'a> for AnthropicIntegrationVisitor { + type Value = AnthropicIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::AnthropicCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AnthropicIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AnthropicIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AnthropicIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_anthropic_integration_type.rs b/src/datadogV2/model/model_anthropic_integration_type.rs new file mode 100644 index 000000000..874dc94bf --- /dev/null +++ b/src/datadogV2/model/model_anthropic_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AnthropicIntegrationType { + ANTHROPIC, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AnthropicIntegrationType { + fn to_string(&self) -> String { + match self { + Self::ANTHROPIC => String::from("Anthropic"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AnthropicIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AnthropicIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Anthropic" => Self::ANTHROPIC, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_anthropic_integration_update.rs b/src/datadogV2/model/model_anthropic_integration_update.rs new file mode 100644 index 000000000..31b8c84e1 --- /dev/null +++ b/src/datadogV2/model/model_anthropic_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AnthropicIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AnthropicIntegrationUpdate { + /// The definition of the `AnthropicCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `AnthropicIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AnthropicIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AnthropicIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::AnthropicIntegrationType, + ) -> AnthropicIntegrationUpdate { + AnthropicIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::AnthropicCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AnthropicIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AnthropicIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for AnthropicIntegrationUpdateVisitor { + type Value = AnthropicIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::AnthropicCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AnthropicIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AnthropicIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AnthropicIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_asana_access_token.rs b/src/datadogV2/model/model_asana_access_token.rs new file mode 100644 index 000000000..0e1e6414b --- /dev/null +++ b/src/datadogV2/model/model_asana_access_token.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AsanaAccessToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AsanaAccessToken { + /// The `AsanaAccessToken` `access_token`. + #[serde(rename = "access_token")] + pub access_token: String, + /// The definition of the `AsanaAccessToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AsanaAccessTokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AsanaAccessToken { + pub fn new( + access_token: String, + type_: crate::datadogV2::model::AsanaAccessTokenType, + ) -> AsanaAccessToken { + AsanaAccessToken { + access_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AsanaAccessToken { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AsanaAccessTokenVisitor; + impl<'a> Visitor<'a> for AsanaAccessTokenVisitor { + type Value = AsanaAccessToken; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut access_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "access_token" => { + access_token = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AsanaAccessTokenType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let access_token = + access_token.ok_or_else(|| M::Error::missing_field("access_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AsanaAccessToken { + access_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AsanaAccessTokenVisitor) + } +} diff --git a/src/datadogV2/model/model_asana_access_token_type.rs b/src/datadogV2/model/model_asana_access_token_type.rs new file mode 100644 index 000000000..a085c58e3 --- /dev/null +++ b/src/datadogV2/model/model_asana_access_token_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AsanaAccessTokenType { + ASANAACCESSTOKEN, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AsanaAccessTokenType { + fn to_string(&self) -> String { + match self { + Self::ASANAACCESSTOKEN => String::from("AsanaAccessToken"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AsanaAccessTokenType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AsanaAccessTokenType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "AsanaAccessToken" => Self::ASANAACCESSTOKEN, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_asana_access_token_update.rs b/src/datadogV2/model/model_asana_access_token_update.rs new file mode 100644 index 000000000..07000a7ef --- /dev/null +++ b/src/datadogV2/model/model_asana_access_token_update.rs @@ -0,0 +1,118 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AsanaAccessToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AsanaAccessTokenUpdate { + /// The `AsanaAccessTokenUpdate` `access_token`. + #[serde(rename = "access_token")] + pub access_token: Option, + /// The definition of the `AsanaAccessToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AsanaAccessTokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AsanaAccessTokenUpdate { + pub fn new(type_: crate::datadogV2::model::AsanaAccessTokenType) -> AsanaAccessTokenUpdate { + AsanaAccessTokenUpdate { + access_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn access_token(mut self, value: String) -> Self { + self.access_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AsanaAccessTokenUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AsanaAccessTokenUpdateVisitor; + impl<'a> Visitor<'a> for AsanaAccessTokenUpdateVisitor { + type Value = AsanaAccessTokenUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut access_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "access_token" => { + if v.is_null() { + continue; + } + access_token = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AsanaAccessTokenType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AsanaAccessTokenUpdate { + access_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AsanaAccessTokenUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_asana_credentials.rs b/src/datadogV2/model/model_asana_credentials.rs new file mode 100644 index 000000000..4b2f60dc4 --- /dev/null +++ b/src/datadogV2/model/model_asana_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `AsanaCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AsanaCredentials { + AsanaAccessToken(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AsanaCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(AsanaCredentials::AsanaAccessToken(_v)); + } + } + + return Ok(AsanaCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_asana_credentials_update.rs b/src/datadogV2/model/model_asana_credentials_update.rs new file mode 100644 index 000000000..d4813a8fe --- /dev/null +++ b/src/datadogV2/model/model_asana_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `AsanaCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AsanaCredentialsUpdate { + AsanaAccessTokenUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AsanaCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(AsanaCredentialsUpdate::AsanaAccessTokenUpdate(_v)); + } + } + + return Ok(AsanaCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_asana_integration.rs b/src/datadogV2/model/model_asana_integration.rs new file mode 100644 index 000000000..c97ebee22 --- /dev/null +++ b/src/datadogV2/model/model_asana_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AsanaIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AsanaIntegration { + /// The definition of the `AsanaCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::AsanaCredentials, + /// The definition of the `AsanaIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AsanaIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AsanaIntegration { + pub fn new( + credentials: crate::datadogV2::model::AsanaCredentials, + type_: crate::datadogV2::model::AsanaIntegrationType, + ) -> AsanaIntegration { + AsanaIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AsanaIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AsanaIntegrationVisitor; + impl<'a> Visitor<'a> for AsanaIntegrationVisitor { + type Value = AsanaIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::AsanaCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AsanaIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AsanaIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AsanaIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_asana_integration_type.rs b/src/datadogV2/model/model_asana_integration_type.rs new file mode 100644 index 000000000..dc97ae753 --- /dev/null +++ b/src/datadogV2/model/model_asana_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AsanaIntegrationType { + ASANA, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AsanaIntegrationType { + fn to_string(&self) -> String { + match self { + Self::ASANA => String::from("Asana"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AsanaIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AsanaIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Asana" => Self::ASANA, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_asana_integration_update.rs b/src/datadogV2/model/model_asana_integration_update.rs new file mode 100644 index 000000000..5c7b9e895 --- /dev/null +++ b/src/datadogV2/model/model_asana_integration_update.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AsanaIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AsanaIntegrationUpdate { + /// The definition of the `AsanaCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `AsanaIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AsanaIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AsanaIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::AsanaIntegrationType) -> AsanaIntegrationUpdate { + AsanaIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::AsanaCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AsanaIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AsanaIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for AsanaIntegrationUpdateVisitor { + type Value = AsanaIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::AsanaCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AsanaIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AsanaIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AsanaIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_azure_credentials.rs b/src/datadogV2/model/model_azure_credentials.rs new file mode 100644 index 000000000..d6d6aa086 --- /dev/null +++ b/src/datadogV2/model/model_azure_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `AzureCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AzureCredentials { + AzureTenant(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AzureCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(AzureCredentials::AzureTenant(_v)); + } + } + + return Ok(AzureCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_azure_credentials_update.rs b/src/datadogV2/model/model_azure_credentials_update.rs new file mode 100644 index 000000000..99e876560 --- /dev/null +++ b/src/datadogV2/model/model_azure_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `AzureCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AzureCredentialsUpdate { + AzureTenantUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AzureCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(AzureCredentialsUpdate::AzureTenantUpdate(_v)); + } + } + + return Ok(AzureCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_azure_integration.rs b/src/datadogV2/model/model_azure_integration.rs new file mode 100644 index 000000000..b7c5cd3ce --- /dev/null +++ b/src/datadogV2/model/model_azure_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AzureIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AzureIntegration { + /// The definition of the `AzureCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::AzureCredentials, + /// The definition of the `AzureIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AzureIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AzureIntegration { + pub fn new( + credentials: crate::datadogV2::model::AzureCredentials, + type_: crate::datadogV2::model::AzureIntegrationType, + ) -> AzureIntegration { + AzureIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AzureIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AzureIntegrationVisitor; + impl<'a> Visitor<'a> for AzureIntegrationVisitor { + type Value = AzureIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::AzureCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AzureIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AzureIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AzureIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_azure_integration_type.rs b/src/datadogV2/model/model_azure_integration_type.rs new file mode 100644 index 000000000..1fa00a19c --- /dev/null +++ b/src/datadogV2/model/model_azure_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AzureIntegrationType { + AZURE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AzureIntegrationType { + fn to_string(&self) -> String { + match self { + Self::AZURE => String::from("Azure"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AzureIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AzureIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Azure" => Self::AZURE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_azure_integration_update.rs b/src/datadogV2/model/model_azure_integration_update.rs new file mode 100644 index 000000000..f8f6ed9ea --- /dev/null +++ b/src/datadogV2/model/model_azure_integration_update.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AzureIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AzureIntegrationUpdate { + /// The definition of the `AzureCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `AzureIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AzureIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AzureIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::AzureIntegrationType) -> AzureIntegrationUpdate { + AzureIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::AzureCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AzureIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AzureIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for AzureIntegrationUpdateVisitor { + type Value = AzureIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::AzureCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AzureIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AzureIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AzureIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_azure_tenant.rs b/src/datadogV2/model/model_azure_tenant.rs new file mode 100644 index 000000000..0fca696f2 --- /dev/null +++ b/src/datadogV2/model/model_azure_tenant.rs @@ -0,0 +1,159 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AzureTenant` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AzureTenant { + /// 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. + #[serde(rename = "app_client_id")] + pub app_client_id: String, + /// 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. + #[serde(rename = "client_secret")] + pub client_secret: String, + /// 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. + #[serde(rename = "custom_scopes")] + pub custom_scopes: Option, + /// 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. + #[serde(rename = "tenant_id")] + pub tenant_id: String, + /// The definition of the `AzureTenant` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AzureTenantType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AzureTenant { + pub fn new( + app_client_id: String, + client_secret: String, + tenant_id: String, + type_: crate::datadogV2::model::AzureTenantType, + ) -> AzureTenant { + AzureTenant { + app_client_id, + client_secret, + custom_scopes: None, + tenant_id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn custom_scopes(mut self, value: String) -> Self { + self.custom_scopes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AzureTenant { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AzureTenantVisitor; + impl<'a> Visitor<'a> for AzureTenantVisitor { + type Value = AzureTenant; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_client_id: Option = None; + let mut client_secret: Option = None; + let mut custom_scopes: Option = None; + let mut tenant_id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_client_id" => { + app_client_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "client_secret" => { + client_secret = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "custom_scopes" => { + if v.is_null() { + continue; + } + custom_scopes = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tenant_id" => { + tenant_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AzureTenantType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let app_client_id = + app_client_id.ok_or_else(|| M::Error::missing_field("app_client_id"))?; + let client_secret = + client_secret.ok_or_else(|| M::Error::missing_field("client_secret"))?; + let tenant_id = tenant_id.ok_or_else(|| M::Error::missing_field("tenant_id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AzureTenant { + app_client_id, + client_secret, + custom_scopes, + tenant_id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AzureTenantVisitor) + } +} diff --git a/src/datadogV2/model/model_azure_tenant_type.rs b/src/datadogV2/model/model_azure_tenant_type.rs new file mode 100644 index 000000000..57027ac48 --- /dev/null +++ b/src/datadogV2/model/model_azure_tenant_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AzureTenantType { + AZURETENANT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AzureTenantType { + fn to_string(&self) -> String { + match self { + Self::AZURETENANT => String::from("AzureTenant"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AzureTenantType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AzureTenantType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "AzureTenant" => Self::AZURETENANT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_azure_tenant_update.rs b/src/datadogV2/model/model_azure_tenant_update.rs new file mode 100644 index 000000000..b65c46db0 --- /dev/null +++ b/src/datadogV2/model/model_azure_tenant_update.rs @@ -0,0 +1,173 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `AzureTenant` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AzureTenantUpdate { + /// 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. + #[serde(rename = "app_client_id")] + pub app_client_id: Option, + /// 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. + #[serde(rename = "client_secret")] + pub client_secret: Option, + /// 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. + #[serde(rename = "custom_scopes")] + pub custom_scopes: Option, + /// 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. + #[serde(rename = "tenant_id")] + pub tenant_id: Option, + /// The definition of the `AzureTenant` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AzureTenantType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AzureTenantUpdate { + pub fn new(type_: crate::datadogV2::model::AzureTenantType) -> AzureTenantUpdate { + AzureTenantUpdate { + app_client_id: None, + client_secret: None, + custom_scopes: None, + tenant_id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_client_id(mut self, value: String) -> Self { + self.app_client_id = Some(value); + self + } + + pub fn client_secret(mut self, value: String) -> Self { + self.client_secret = Some(value); + self + } + + pub fn custom_scopes(mut self, value: String) -> Self { + self.custom_scopes = Some(value); + self + } + + pub fn tenant_id(mut self, value: String) -> Self { + self.tenant_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AzureTenantUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AzureTenantUpdateVisitor; + impl<'a> Visitor<'a> for AzureTenantUpdateVisitor { + type Value = AzureTenantUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_client_id: Option = None; + let mut client_secret: Option = None; + let mut custom_scopes: Option = None; + let mut tenant_id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_client_id" => { + if v.is_null() { + continue; + } + app_client_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "client_secret" => { + if v.is_null() { + continue; + } + client_secret = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "custom_scopes" => { + if v.is_null() { + continue; + } + custom_scopes = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tenant_id" => { + if v.is_null() { + continue; + } + tenant_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AzureTenantType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AzureTenantUpdate { + app_client_id, + client_secret, + custom_scopes, + tenant_id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AzureTenantUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_circle_ci_credentials.rs b/src/datadogV2/model/model_circle_ci_credentials.rs new file mode 100644 index 000000000..31e5c220b --- /dev/null +++ b/src/datadogV2/model/model_circle_ci_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `CircleCICredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum CircleCICredentials { + CircleCIAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for CircleCICredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(CircleCICredentials::CircleCIAPIKey(_v)); + } + } + + return Ok(CircleCICredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_circle_ci_credentials_update.rs b/src/datadogV2/model/model_circle_ci_credentials_update.rs new file mode 100644 index 000000000..61ae7fcd7 --- /dev/null +++ b/src/datadogV2/model/model_circle_ci_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `CircleCICredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum CircleCICredentialsUpdate { + CircleCIAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for CircleCICredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(CircleCICredentialsUpdate::CircleCIAPIKeyUpdate(_v)); + } + } + + return Ok(CircleCICredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_circle_ci_integration.rs b/src/datadogV2/model/model_circle_ci_integration.rs new file mode 100644 index 000000000..21cb54316 --- /dev/null +++ b/src/datadogV2/model/model_circle_ci_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CircleCIIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CircleCIIntegration { + /// The definition of the `CircleCICredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::CircleCICredentials, + /// The definition of the `CircleCIIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CircleCIIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CircleCIIntegration { + pub fn new( + credentials: crate::datadogV2::model::CircleCICredentials, + type_: crate::datadogV2::model::CircleCIIntegrationType, + ) -> CircleCIIntegration { + CircleCIIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CircleCIIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CircleCIIntegrationVisitor; + impl<'a> Visitor<'a> for CircleCIIntegrationVisitor { + type Value = CircleCIIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::CircleCICredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CircleCIIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CircleCIIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CircleCIIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_circle_ci_integration_type.rs b/src/datadogV2/model/model_circle_ci_integration_type.rs new file mode 100644 index 000000000..feba091c3 --- /dev/null +++ b/src/datadogV2/model/model_circle_ci_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CircleCIIntegrationType { + CIRCLECI, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CircleCIIntegrationType { + fn to_string(&self) -> String { + match self { + Self::CIRCLECI => String::from("CircleCI"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CircleCIIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CircleCIIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "CircleCI" => Self::CIRCLECI, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_circle_ci_integration_update.rs b/src/datadogV2/model/model_circle_ci_integration_update.rs new file mode 100644 index 000000000..a2ca0a766 --- /dev/null +++ b/src/datadogV2/model/model_circle_ci_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CircleCIIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CircleCIIntegrationUpdate { + /// The definition of the `CircleCICredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `CircleCIIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CircleCIIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CircleCIIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::CircleCIIntegrationType, + ) -> CircleCIIntegrationUpdate { + CircleCIIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::CircleCICredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CircleCIIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CircleCIIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for CircleCIIntegrationUpdateVisitor { + type Value = CircleCIIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::CircleCICredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CircleCIIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CircleCIIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CircleCIIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_circle_ciapi_key.rs b/src/datadogV2/model/model_circle_ciapi_key.rs new file mode 100644 index 000000000..1575cf0d6 --- /dev/null +++ b/src/datadogV2/model/model_circle_ciapi_key.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CircleCIAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CircleCIAPIKey { + /// The `CircleCIAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `CircleCIAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CircleCIAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CircleCIAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::CircleCIAPIKeyType, + ) -> CircleCIAPIKey { + CircleCIAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CircleCIAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CircleCIAPIKeyVisitor; + impl<'a> Visitor<'a> for CircleCIAPIKeyVisitor { + type Value = CircleCIAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CircleCIAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CircleCIAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CircleCIAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_circle_ciapi_key_type.rs b/src/datadogV2/model/model_circle_ciapi_key_type.rs new file mode 100644 index 000000000..946e8c40a --- /dev/null +++ b/src/datadogV2/model/model_circle_ciapi_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CircleCIAPIKeyType { + CIRCLECIAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CircleCIAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::CIRCLECIAPIKEY => String::from("CircleCIAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CircleCIAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CircleCIAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "CircleCIAPIKey" => Self::CIRCLECIAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_circle_ciapi_key_update.rs b/src/datadogV2/model/model_circle_ciapi_key_update.rs new file mode 100644 index 000000000..1bb4f9074 --- /dev/null +++ b/src/datadogV2/model/model_circle_ciapi_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CircleCIAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CircleCIAPIKeyUpdate { + /// The `CircleCIAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `CircleCIAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CircleCIAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CircleCIAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::CircleCIAPIKeyType) -> CircleCIAPIKeyUpdate { + CircleCIAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CircleCIAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CircleCIAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for CircleCIAPIKeyUpdateVisitor { + type Value = CircleCIAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CircleCIAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CircleCIAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CircleCIAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_clickup_api_key.rs b/src/datadogV2/model/model_clickup_api_key.rs new file mode 100644 index 000000000..b3cea2bf4 --- /dev/null +++ b/src/datadogV2/model/model_clickup_api_key.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ClickupAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ClickupAPIKey { + /// The `ClickupAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `ClickupAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ClickupAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ClickupAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::ClickupAPIKeyType, + ) -> ClickupAPIKey { + ClickupAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ClickupAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ClickupAPIKeyVisitor; + impl<'a> Visitor<'a> for ClickupAPIKeyVisitor { + type Value = ClickupAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ClickupAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ClickupAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ClickupAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_clickup_api_key_type.rs b/src/datadogV2/model/model_clickup_api_key_type.rs new file mode 100644 index 000000000..07838f188 --- /dev/null +++ b/src/datadogV2/model/model_clickup_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ClickupAPIKeyType { + CLICKUPAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ClickupAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::CLICKUPAPIKEY => String::from("ClickupAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ClickupAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ClickupAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ClickupAPIKey" => Self::CLICKUPAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_clickup_api_key_update.rs b/src/datadogV2/model/model_clickup_api_key_update.rs new file mode 100644 index 000000000..5b652e34d --- /dev/null +++ b/src/datadogV2/model/model_clickup_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ClickupAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ClickupAPIKeyUpdate { + /// The `ClickupAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `ClickupAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ClickupAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ClickupAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::ClickupAPIKeyType) -> ClickupAPIKeyUpdate { + ClickupAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ClickupAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ClickupAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for ClickupAPIKeyUpdateVisitor { + type Value = ClickupAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ClickupAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ClickupAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ClickupAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_clickup_credentials.rs b/src/datadogV2/model/model_clickup_credentials.rs new file mode 100644 index 000000000..e3847e8ee --- /dev/null +++ b/src/datadogV2/model/model_clickup_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `ClickupCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ClickupCredentials { + ClickupAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ClickupCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ClickupCredentials::ClickupAPIKey(_v)); + } + } + + return Ok(ClickupCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_clickup_credentials_update.rs b/src/datadogV2/model/model_clickup_credentials_update.rs new file mode 100644 index 000000000..3a9db2cf4 --- /dev/null +++ b/src/datadogV2/model/model_clickup_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `ClickupCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ClickupCredentialsUpdate { + ClickupAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ClickupCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ClickupCredentialsUpdate::ClickupAPIKeyUpdate(_v)); + } + } + + return Ok(ClickupCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_clickup_integration.rs b/src/datadogV2/model/model_clickup_integration.rs new file mode 100644 index 000000000..459276568 --- /dev/null +++ b/src/datadogV2/model/model_clickup_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ClickupIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ClickupIntegration { + /// The definition of the `ClickupCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::ClickupCredentials, + /// The definition of the `ClickupIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ClickupIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ClickupIntegration { + pub fn new( + credentials: crate::datadogV2::model::ClickupCredentials, + type_: crate::datadogV2::model::ClickupIntegrationType, + ) -> ClickupIntegration { + ClickupIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ClickupIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ClickupIntegrationVisitor; + impl<'a> Visitor<'a> for ClickupIntegrationVisitor { + type Value = ClickupIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::ClickupCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ClickupIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ClickupIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ClickupIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_clickup_integration_type.rs b/src/datadogV2/model/model_clickup_integration_type.rs new file mode 100644 index 000000000..f2725dbdc --- /dev/null +++ b/src/datadogV2/model/model_clickup_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ClickupIntegrationType { + CLICKUP, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ClickupIntegrationType { + fn to_string(&self) -> String { + match self { + Self::CLICKUP => String::from("Clickup"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ClickupIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ClickupIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Clickup" => Self::CLICKUP, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_clickup_integration_update.rs b/src/datadogV2/model/model_clickup_integration_update.rs new file mode 100644 index 000000000..548931c6e --- /dev/null +++ b/src/datadogV2/model/model_clickup_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ClickupIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ClickupIntegrationUpdate { + /// The definition of the `ClickupCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `ClickupIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ClickupIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ClickupIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::ClickupIntegrationType) -> ClickupIntegrationUpdate { + ClickupIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::ClickupCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ClickupIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ClickupIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for ClickupIntegrationUpdateVisitor { + type Value = ClickupIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::ClickupCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ClickupIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ClickupIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ClickupIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_cloudflare_api_token.rs b/src/datadogV2/model/model_cloudflare_api_token.rs new file mode 100644 index 000000000..22c53cb78 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_api_token.rs @@ -0,0 +1,113 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CloudflareAPIToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudflareAPIToken { + /// The `CloudflareAPIToken` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `CloudflareAPIToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CloudflareAPITokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudflareAPIToken { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::CloudflareAPITokenType, + ) -> CloudflareAPIToken { + CloudflareAPIToken { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudflareAPIToken { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudflareAPITokenVisitor; + impl<'a> Visitor<'a> for CloudflareAPITokenVisitor { + type Value = CloudflareAPIToken; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CloudflareAPITokenType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudflareAPIToken { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudflareAPITokenVisitor) + } +} diff --git a/src/datadogV2/model/model_cloudflare_api_token_type.rs b/src/datadogV2/model/model_cloudflare_api_token_type.rs new file mode 100644 index 000000000..6d28ea219 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_api_token_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CloudflareAPITokenType { + CLOUDFLAREAPITOKEN, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudflareAPITokenType { + fn to_string(&self) -> String { + match self { + Self::CLOUDFLAREAPITOKEN => String::from("CloudflareAPIToken"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudflareAPITokenType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CloudflareAPITokenType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "CloudflareAPIToken" => Self::CLOUDFLAREAPITOKEN, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_cloudflare_api_token_update.rs b/src/datadogV2/model/model_cloudflare_api_token_update.rs new file mode 100644 index 000000000..c47522ce9 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_api_token_update.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CloudflareAPIToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudflareAPITokenUpdate { + /// The `CloudflareAPITokenUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `CloudflareAPIToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CloudflareAPITokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudflareAPITokenUpdate { + pub fn new(type_: crate::datadogV2::model::CloudflareAPITokenType) -> CloudflareAPITokenUpdate { + CloudflareAPITokenUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudflareAPITokenUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudflareAPITokenUpdateVisitor; + impl<'a> Visitor<'a> for CloudflareAPITokenUpdateVisitor { + type Value = CloudflareAPITokenUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CloudflareAPITokenType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudflareAPITokenUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudflareAPITokenUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_cloudflare_credentials.rs b/src/datadogV2/model/model_cloudflare_credentials.rs new file mode 100644 index 000000000..dfc8f2efc --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_credentials.rs @@ -0,0 +1,42 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `CloudflareCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum CloudflareCredentials { + CloudflareAPIToken(Box), + CloudflareGlobalAPIToken(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for CloudflareCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(CloudflareCredentials::CloudflareAPIToken(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(CloudflareCredentials::CloudflareGlobalAPIToken(_v)); + } + } + + return Ok(CloudflareCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_cloudflare_credentials_update.rs b/src/datadogV2/model/model_cloudflare_credentials_update.rs new file mode 100644 index 000000000..dea229132 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_credentials_update.rs @@ -0,0 +1,45 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `CloudflareCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum CloudflareCredentialsUpdate { + CloudflareAPITokenUpdate(Box), + CloudflareGlobalAPITokenUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for CloudflareCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(CloudflareCredentialsUpdate::CloudflareAPITokenUpdate(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(CloudflareCredentialsUpdate::CloudflareGlobalAPITokenUpdate( + _v, + )); + } + } + + return Ok(CloudflareCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_cloudflare_global_api_token.rs b/src/datadogV2/model/model_cloudflare_global_api_token.rs new file mode 100644 index 000000000..e6bd7ebf1 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_global_api_token.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CloudflareGlobalAPIToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudflareGlobalAPIToken { + /// The `CloudflareGlobalAPIToken` `auth_email`. + #[serde(rename = "auth_email")] + pub auth_email: String, + /// The `CloudflareGlobalAPIToken` `global_api_key`. + #[serde(rename = "global_api_key")] + pub global_api_key: String, + /// The definition of the `CloudflareGlobalAPIToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CloudflareGlobalAPITokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudflareGlobalAPIToken { + pub fn new( + auth_email: String, + global_api_key: String, + type_: crate::datadogV2::model::CloudflareGlobalAPITokenType, + ) -> CloudflareGlobalAPIToken { + CloudflareGlobalAPIToken { + auth_email, + global_api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudflareGlobalAPIToken { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudflareGlobalAPITokenVisitor; + impl<'a> Visitor<'a> for CloudflareGlobalAPITokenVisitor { + type Value = CloudflareGlobalAPIToken; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut auth_email: Option = None; + let mut global_api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "auth_email" => { + auth_email = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_api_key" => { + global_api_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CloudflareGlobalAPITokenType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let auth_email = auth_email.ok_or_else(|| M::Error::missing_field("auth_email"))?; + let global_api_key = + global_api_key.ok_or_else(|| M::Error::missing_field("global_api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudflareGlobalAPIToken { + auth_email, + global_api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudflareGlobalAPITokenVisitor) + } +} diff --git a/src/datadogV2/model/model_cloudflare_global_api_token_type.rs b/src/datadogV2/model/model_cloudflare_global_api_token_type.rs new file mode 100644 index 000000000..9432dfbc2 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_global_api_token_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CloudflareGlobalAPITokenType { + CLOUDFLAREGLOBALAPITOKEN, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudflareGlobalAPITokenType { + fn to_string(&self) -> String { + match self { + Self::CLOUDFLAREGLOBALAPITOKEN => String::from("CloudflareGlobalAPIToken"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudflareGlobalAPITokenType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CloudflareGlobalAPITokenType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "CloudflareGlobalAPIToken" => Self::CLOUDFLAREGLOBALAPITOKEN, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_cloudflare_global_api_token_update.rs b/src/datadogV2/model/model_cloudflare_global_api_token_update.rs new file mode 100644 index 000000000..0a09cebc2 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_global_api_token_update.rs @@ -0,0 +1,137 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CloudflareGlobalAPIToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudflareGlobalAPITokenUpdate { + /// The `CloudflareGlobalAPITokenUpdate` `auth_email`. + #[serde(rename = "auth_email")] + pub auth_email: Option, + /// The `CloudflareGlobalAPITokenUpdate` `global_api_key`. + #[serde(rename = "global_api_key")] + pub global_api_key: Option, + /// The definition of the `CloudflareGlobalAPIToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CloudflareGlobalAPITokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudflareGlobalAPITokenUpdate { + pub fn new( + type_: crate::datadogV2::model::CloudflareGlobalAPITokenType, + ) -> CloudflareGlobalAPITokenUpdate { + CloudflareGlobalAPITokenUpdate { + auth_email: None, + global_api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn auth_email(mut self, value: String) -> Self { + self.auth_email = Some(value); + self + } + + pub fn global_api_key(mut self, value: String) -> Self { + self.global_api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudflareGlobalAPITokenUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudflareGlobalAPITokenUpdateVisitor; + impl<'a> Visitor<'a> for CloudflareGlobalAPITokenUpdateVisitor { + type Value = CloudflareGlobalAPITokenUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut auth_email: Option = None; + let mut global_api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "auth_email" => { + if v.is_null() { + continue; + } + auth_email = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_api_key" => { + if v.is_null() { + continue; + } + global_api_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CloudflareGlobalAPITokenType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudflareGlobalAPITokenUpdate { + auth_email, + global_api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudflareGlobalAPITokenUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_cloudflare_integration.rs b/src/datadogV2/model/model_cloudflare_integration.rs new file mode 100644 index 000000000..028484f92 --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CloudflareIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudflareIntegration { + /// The definition of the `CloudflareCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::CloudflareCredentials, + /// The definition of the `CloudflareIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CloudflareIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudflareIntegration { + pub fn new( + credentials: crate::datadogV2::model::CloudflareCredentials, + type_: crate::datadogV2::model::CloudflareIntegrationType, + ) -> CloudflareIntegration { + CloudflareIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudflareIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudflareIntegrationVisitor; + impl<'a> Visitor<'a> for CloudflareIntegrationVisitor { + type Value = CloudflareIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::CloudflareCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CloudflareIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudflareIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudflareIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_cloudflare_integration_type.rs b/src/datadogV2/model/model_cloudflare_integration_type.rs new file mode 100644 index 000000000..c27754dac --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CloudflareIntegrationType { + CLOUDFLARE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudflareIntegrationType { + fn to_string(&self) -> String { + match self { + Self::CLOUDFLARE => String::from("Cloudflare"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudflareIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CloudflareIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Cloudflare" => Self::CLOUDFLARE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_cloudflare_integration_update.rs b/src/datadogV2/model/model_cloudflare_integration_update.rs new file mode 100644 index 000000000..0111fd80e --- /dev/null +++ b/src/datadogV2/model/model_cloudflare_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `CloudflareIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudflareIntegrationUpdate { + /// The definition of the `CloudflareCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `CloudflareIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CloudflareIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudflareIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::CloudflareIntegrationType, + ) -> CloudflareIntegrationUpdate { + CloudflareIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::CloudflareCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudflareIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudflareIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for CloudflareIntegrationUpdateVisitor { + type Value = CloudflareIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::CloudflareCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CloudflareIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudflareIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudflareIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_config_cat_credentials.rs b/src/datadogV2/model/model_config_cat_credentials.rs new file mode 100644 index 000000000..8abb19ad9 --- /dev/null +++ b/src/datadogV2/model/model_config_cat_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `ConfigCatCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ConfigCatCredentials { + ConfigCatSDKKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ConfigCatCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ConfigCatCredentials::ConfigCatSDKKey(_v)); + } + } + + return Ok(ConfigCatCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_config_cat_credentials_update.rs b/src/datadogV2/model/model_config_cat_credentials_update.rs new file mode 100644 index 000000000..378a7a133 --- /dev/null +++ b/src/datadogV2/model/model_config_cat_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `ConfigCatCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ConfigCatCredentialsUpdate { + ConfigCatSDKKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ConfigCatCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ConfigCatCredentialsUpdate::ConfigCatSDKKeyUpdate(_v)); + } + } + + return Ok(ConfigCatCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_config_cat_integration.rs b/src/datadogV2/model/model_config_cat_integration.rs new file mode 100644 index 000000000..3d7a5ab9d --- /dev/null +++ b/src/datadogV2/model/model_config_cat_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ConfigCatIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConfigCatIntegration { + /// The definition of the `ConfigCatCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::ConfigCatCredentials, + /// The definition of the `ConfigCatIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ConfigCatIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConfigCatIntegration { + pub fn new( + credentials: crate::datadogV2::model::ConfigCatCredentials, + type_: crate::datadogV2::model::ConfigCatIntegrationType, + ) -> ConfigCatIntegration { + ConfigCatIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConfigCatIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConfigCatIntegrationVisitor; + impl<'a> Visitor<'a> for ConfigCatIntegrationVisitor { + type Value = ConfigCatIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::ConfigCatCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ConfigCatIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConfigCatIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConfigCatIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_config_cat_integration_type.rs b/src/datadogV2/model/model_config_cat_integration_type.rs new file mode 100644 index 000000000..772d2c3b6 --- /dev/null +++ b/src/datadogV2/model/model_config_cat_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ConfigCatIntegrationType { + CONFIGCAT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ConfigCatIntegrationType { + fn to_string(&self) -> String { + match self { + Self::CONFIGCAT => String::from("ConfigCat"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ConfigCatIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ConfigCatIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ConfigCat" => Self::CONFIGCAT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_config_cat_integration_update.rs b/src/datadogV2/model/model_config_cat_integration_update.rs new file mode 100644 index 000000000..fbc61f349 --- /dev/null +++ b/src/datadogV2/model/model_config_cat_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ConfigCatIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConfigCatIntegrationUpdate { + /// The definition of the `ConfigCatCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `ConfigCatIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ConfigCatIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConfigCatIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::ConfigCatIntegrationType, + ) -> ConfigCatIntegrationUpdate { + ConfigCatIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::ConfigCatCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConfigCatIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConfigCatIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for ConfigCatIntegrationUpdateVisitor { + type Value = ConfigCatIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::ConfigCatCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ConfigCatIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConfigCatIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConfigCatIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_config_cat_sdk_key.rs b/src/datadogV2/model/model_config_cat_sdk_key.rs new file mode 100644 index 000000000..67df010fb --- /dev/null +++ b/src/datadogV2/model/model_config_cat_sdk_key.rs @@ -0,0 +1,139 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ConfigCatSDKKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConfigCatSDKKey { + /// The `ConfigCatSDKKey` `api_password`. + #[serde(rename = "api_password")] + pub api_password: String, + /// The `ConfigCatSDKKey` `api_username`. + #[serde(rename = "api_username")] + pub api_username: String, + /// The `ConfigCatSDKKey` `sdk_key`. + #[serde(rename = "sdk_key")] + pub sdk_key: String, + /// The definition of the `ConfigCatSDKKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ConfigCatSDKKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConfigCatSDKKey { + pub fn new( + api_password: String, + api_username: String, + sdk_key: String, + type_: crate::datadogV2::model::ConfigCatSDKKeyType, + ) -> ConfigCatSDKKey { + ConfigCatSDKKey { + api_password, + api_username, + sdk_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConfigCatSDKKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConfigCatSDKKeyVisitor; + impl<'a> Visitor<'a> for ConfigCatSDKKeyVisitor { + type Value = ConfigCatSDKKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_password: Option = None; + let mut api_username: Option = None; + let mut sdk_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_password" => { + api_password = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "api_username" => { + api_username = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "sdk_key" => { + sdk_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ConfigCatSDKKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_password = + api_password.ok_or_else(|| M::Error::missing_field("api_password"))?; + let api_username = + api_username.ok_or_else(|| M::Error::missing_field("api_username"))?; + let sdk_key = sdk_key.ok_or_else(|| M::Error::missing_field("sdk_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConfigCatSDKKey { + api_password, + api_username, + sdk_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConfigCatSDKKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_config_cat_sdk_key_type.rs b/src/datadogV2/model/model_config_cat_sdk_key_type.rs new file mode 100644 index 000000000..04bc484aa --- /dev/null +++ b/src/datadogV2/model/model_config_cat_sdk_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ConfigCatSDKKeyType { + CONFIGCATSDKKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ConfigCatSDKKeyType { + fn to_string(&self) -> String { + match self { + Self::CONFIGCATSDKKEY => String::from("ConfigCatSDKKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ConfigCatSDKKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ConfigCatSDKKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ConfigCatSDKKey" => Self::CONFIGCATSDKKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_config_cat_sdk_key_update.rs b/src/datadogV2/model/model_config_cat_sdk_key_update.rs new file mode 100644 index 000000000..70583a029 --- /dev/null +++ b/src/datadogV2/model/model_config_cat_sdk_key_update.rs @@ -0,0 +1,153 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ConfigCatSDKKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConfigCatSDKKeyUpdate { + /// The `ConfigCatSDKKeyUpdate` `api_password`. + #[serde(rename = "api_password")] + pub api_password: Option, + /// The `ConfigCatSDKKeyUpdate` `api_username`. + #[serde(rename = "api_username")] + pub api_username: Option, + /// The `ConfigCatSDKKeyUpdate` `sdk_key`. + #[serde(rename = "sdk_key")] + pub sdk_key: Option, + /// The definition of the `ConfigCatSDKKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ConfigCatSDKKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConfigCatSDKKeyUpdate { + pub fn new(type_: crate::datadogV2::model::ConfigCatSDKKeyType) -> ConfigCatSDKKeyUpdate { + ConfigCatSDKKeyUpdate { + api_password: None, + api_username: None, + sdk_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_password(mut self, value: String) -> Self { + self.api_password = Some(value); + self + } + + pub fn api_username(mut self, value: String) -> Self { + self.api_username = Some(value); + self + } + + pub fn sdk_key(mut self, value: String) -> Self { + self.sdk_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConfigCatSDKKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConfigCatSDKKeyUpdateVisitor; + impl<'a> Visitor<'a> for ConfigCatSDKKeyUpdateVisitor { + type Value = ConfigCatSDKKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_password: Option = None; + let mut api_username: Option = None; + let mut sdk_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_password" => { + if v.is_null() { + continue; + } + api_password = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "api_username" => { + if v.is_null() { + continue; + } + api_username = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "sdk_key" => { + if v.is_null() { + continue; + } + sdk_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ConfigCatSDKKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConfigCatSDKKeyUpdate { + api_password, + api_username, + sdk_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConfigCatSDKKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_fastly_api_key.rs b/src/datadogV2/model/model_fastly_api_key.rs new file mode 100644 index 000000000..750b97417 --- /dev/null +++ b/src/datadogV2/model/model_fastly_api_key.rs @@ -0,0 +1,112 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FastlyAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FastlyAPIKey { + /// The `FastlyAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The definition of the `FastlyAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FastlyAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FastlyAPIKey { + pub fn new(api_key: String, type_: crate::datadogV2::model::FastlyAPIKeyType) -> FastlyAPIKey { + FastlyAPIKey { + api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FastlyAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FastlyAPIKeyVisitor; + impl<'a> Visitor<'a> for FastlyAPIKeyVisitor { + type Value = FastlyAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FastlyAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FastlyAPIKey { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FastlyAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_fastly_api_key_type.rs b/src/datadogV2/model/model_fastly_api_key_type.rs new file mode 100644 index 000000000..ba0800506 --- /dev/null +++ b/src/datadogV2/model/model_fastly_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FastlyAPIKeyType { + FASTLYAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FastlyAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::FASTLYAPIKEY => String::from("FastlyAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FastlyAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FastlyAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "FastlyAPIKey" => Self::FASTLYAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_fastly_api_key_update.rs b/src/datadogV2/model/model_fastly_api_key_update.rs new file mode 100644 index 000000000..fa879e247 --- /dev/null +++ b/src/datadogV2/model/model_fastly_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FastlyAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FastlyAPIKeyUpdate { + /// The `FastlyAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The definition of the `FastlyAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FastlyAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FastlyAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::FastlyAPIKeyType) -> FastlyAPIKeyUpdate { + FastlyAPIKeyUpdate { + api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FastlyAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FastlyAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for FastlyAPIKeyUpdateVisitor { + type Value = FastlyAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FastlyAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FastlyAPIKeyUpdate { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FastlyAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_fastly_credentials.rs b/src/datadogV2/model/model_fastly_credentials.rs new file mode 100644 index 000000000..a7412f992 --- /dev/null +++ b/src/datadogV2/model/model_fastly_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `FastlyCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum FastlyCredentials { + FastlyAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for FastlyCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(FastlyCredentials::FastlyAPIKey(_v)); + } + } + + return Ok(FastlyCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_fastly_credentials_update.rs b/src/datadogV2/model/model_fastly_credentials_update.rs new file mode 100644 index 000000000..6cff30efe --- /dev/null +++ b/src/datadogV2/model/model_fastly_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `FastlyCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum FastlyCredentialsUpdate { + FastlyAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for FastlyCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(FastlyCredentialsUpdate::FastlyAPIKeyUpdate(_v)); + } + } + + return Ok(FastlyCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_fastly_integration.rs b/src/datadogV2/model/model_fastly_integration.rs new file mode 100644 index 000000000..41ecf8167 --- /dev/null +++ b/src/datadogV2/model/model_fastly_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FastlyIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FastlyIntegration { + /// The definition of the `FastlyCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::FastlyCredentials, + /// The definition of the `FastlyIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FastlyIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FastlyIntegration { + pub fn new( + credentials: crate::datadogV2::model::FastlyCredentials, + type_: crate::datadogV2::model::FastlyIntegrationType, + ) -> FastlyIntegration { + FastlyIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FastlyIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FastlyIntegrationVisitor; + impl<'a> Visitor<'a> for FastlyIntegrationVisitor { + type Value = FastlyIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::FastlyCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FastlyIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FastlyIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FastlyIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_fastly_integration_type.rs b/src/datadogV2/model/model_fastly_integration_type.rs new file mode 100644 index 000000000..92a2e7887 --- /dev/null +++ b/src/datadogV2/model/model_fastly_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FastlyIntegrationType { + FASTLY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FastlyIntegrationType { + fn to_string(&self) -> String { + match self { + Self::FASTLY => String::from("Fastly"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FastlyIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FastlyIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Fastly" => Self::FASTLY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_fastly_integration_update.rs b/src/datadogV2/model/model_fastly_integration_update.rs new file mode 100644 index 000000000..26f84aa99 --- /dev/null +++ b/src/datadogV2/model/model_fastly_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FastlyIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FastlyIntegrationUpdate { + /// The definition of the `FastlyCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `FastlyIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FastlyIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FastlyIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::FastlyIntegrationType) -> FastlyIntegrationUpdate { + FastlyIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::FastlyCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FastlyIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FastlyIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for FastlyIntegrationUpdateVisitor { + type Value = FastlyIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::FastlyCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FastlyIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FastlyIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FastlyIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_freshservice_api_key.rs b/src/datadogV2/model/model_freshservice_api_key.rs new file mode 100644 index 000000000..56f22d53c --- /dev/null +++ b/src/datadogV2/model/model_freshservice_api_key.rs @@ -0,0 +1,124 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FreshserviceAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FreshserviceAPIKey { + /// The `FreshserviceAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The `FreshserviceAPIKey` `domain`. + #[serde(rename = "domain")] + pub domain: String, + /// The definition of the `FreshserviceAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FreshserviceAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FreshserviceAPIKey { + pub fn new( + api_key: String, + domain: String, + type_: crate::datadogV2::model::FreshserviceAPIKeyType, + ) -> FreshserviceAPIKey { + FreshserviceAPIKey { + api_key, + domain, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FreshserviceAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FreshserviceAPIKeyVisitor; + impl<'a> Visitor<'a> for FreshserviceAPIKeyVisitor { + type Value = FreshserviceAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut domain: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "domain" => { + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FreshserviceAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FreshserviceAPIKey { + api_key, + domain, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FreshserviceAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_freshservice_api_key_type.rs b/src/datadogV2/model/model_freshservice_api_key_type.rs new file mode 100644 index 000000000..dee37d549 --- /dev/null +++ b/src/datadogV2/model/model_freshservice_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FreshserviceAPIKeyType { + FRESHSERVICEAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FreshserviceAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::FRESHSERVICEAPIKEY => String::from("FreshserviceAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FreshserviceAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FreshserviceAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "FreshserviceAPIKey" => Self::FRESHSERVICEAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_freshservice_api_key_update.rs b/src/datadogV2/model/model_freshservice_api_key_update.rs new file mode 100644 index 000000000..547ee6982 --- /dev/null +++ b/src/datadogV2/model/model_freshservice_api_key_update.rs @@ -0,0 +1,134 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FreshserviceAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FreshserviceAPIKeyUpdate { + /// The `FreshserviceAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The `FreshserviceAPIKeyUpdate` `domain`. + #[serde(rename = "domain")] + pub domain: Option, + /// The definition of the `FreshserviceAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FreshserviceAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FreshserviceAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::FreshserviceAPIKeyType) -> FreshserviceAPIKeyUpdate { + FreshserviceAPIKeyUpdate { + api_key: None, + domain: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FreshserviceAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FreshserviceAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for FreshserviceAPIKeyUpdateVisitor { + type Value = FreshserviceAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut domain: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FreshserviceAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FreshserviceAPIKeyUpdate { + api_key, + domain, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FreshserviceAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_freshservice_credentials.rs b/src/datadogV2/model/model_freshservice_credentials.rs new file mode 100644 index 000000000..1fa558a63 --- /dev/null +++ b/src/datadogV2/model/model_freshservice_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `FreshserviceCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum FreshserviceCredentials { + FreshserviceAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for FreshserviceCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(FreshserviceCredentials::FreshserviceAPIKey(_v)); + } + } + + return Ok(FreshserviceCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_freshservice_credentials_update.rs b/src/datadogV2/model/model_freshservice_credentials_update.rs new file mode 100644 index 000000000..2085e3de9 --- /dev/null +++ b/src/datadogV2/model/model_freshservice_credentials_update.rs @@ -0,0 +1,34 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `FreshserviceCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum FreshserviceCredentialsUpdate { + FreshserviceAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for FreshserviceCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(FreshserviceCredentialsUpdate::FreshserviceAPIKeyUpdate(_v)); + } + } + + return Ok(FreshserviceCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_freshservice_integration.rs b/src/datadogV2/model/model_freshservice_integration.rs new file mode 100644 index 000000000..45b5a4086 --- /dev/null +++ b/src/datadogV2/model/model_freshservice_integration.rs @@ -0,0 +1,124 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FreshserviceIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FreshserviceIntegration { + /// The definition of the `FreshserviceCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::FreshserviceCredentials, + /// The definition of the `FreshserviceIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FreshserviceIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FreshserviceIntegration { + pub fn new( + credentials: crate::datadogV2::model::FreshserviceCredentials, + type_: crate::datadogV2::model::FreshserviceIntegrationType, + ) -> FreshserviceIntegration { + FreshserviceIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FreshserviceIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FreshserviceIntegrationVisitor; + impl<'a> Visitor<'a> for FreshserviceIntegrationVisitor { + type Value = FreshserviceIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::FreshserviceCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FreshserviceIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FreshserviceIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FreshserviceIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_freshservice_integration_type.rs b/src/datadogV2/model/model_freshservice_integration_type.rs new file mode 100644 index 000000000..63c28d76e --- /dev/null +++ b/src/datadogV2/model/model_freshservice_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FreshserviceIntegrationType { + FRESHSERVICE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for FreshserviceIntegrationType { + fn to_string(&self) -> String { + match self { + Self::FRESHSERVICE => String::from("Freshservice"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for FreshserviceIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for FreshserviceIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Freshservice" => Self::FRESHSERVICE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_freshservice_integration_update.rs b/src/datadogV2/model/model_freshservice_integration_update.rs new file mode 100644 index 000000000..d7df968a7 --- /dev/null +++ b/src/datadogV2/model/model_freshservice_integration_update.rs @@ -0,0 +1,133 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `FreshserviceIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct FreshserviceIntegrationUpdate { + /// The definition of the `FreshserviceCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `FreshserviceIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::FreshserviceIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl FreshserviceIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::FreshserviceIntegrationType, + ) -> FreshserviceIntegrationUpdate { + FreshserviceIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::FreshserviceCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for FreshserviceIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FreshserviceIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for FreshserviceIntegrationUpdateVisitor { + type Value = FreshserviceIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option< + crate::datadogV2::model::FreshserviceCredentialsUpdate, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::FreshserviceCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::FreshserviceIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = FreshserviceIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(FreshserviceIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_gcp_credentials.rs b/src/datadogV2/model/model_gcp_credentials.rs new file mode 100644 index 000000000..e9b2b4acf --- /dev/null +++ b/src/datadogV2/model/model_gcp_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GCPCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GCPCredentials { + GCPServiceAccount(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GCPCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(GCPCredentials::GCPServiceAccount(_v)); + } + } + + return Ok(GCPCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_gcp_credentials_update.rs b/src/datadogV2/model/model_gcp_credentials_update.rs new file mode 100644 index 000000000..90b0dab22 --- /dev/null +++ b/src/datadogV2/model/model_gcp_credentials_update.rs @@ -0,0 +1,34 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GCPCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GCPCredentialsUpdate { + GCPServiceAccountUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GCPCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(GCPCredentialsUpdate::GCPServiceAccountUpdate(_v)); + } + } + + return Ok(GCPCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_gcp_integration.rs b/src/datadogV2/model/model_gcp_integration.rs new file mode 100644 index 000000000..8c06d5f61 --- /dev/null +++ b/src/datadogV2/model/model_gcp_integration.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GCPIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GCPIntegration { + /// The definition of the `GCPCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::GCPCredentials, + /// The definition of the `GCPIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GCPIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GCPIntegration { + pub fn new( + credentials: crate::datadogV2::model::GCPCredentials, + type_: crate::datadogV2::model::GCPIntegrationType, + ) -> GCPIntegration { + GCPIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GCPIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GCPIntegrationVisitor; + impl<'a> Visitor<'a> for GCPIntegrationVisitor { + type Value = GCPIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GCPCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GCPIntegrationType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GCPIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GCPIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_gcp_integration_type.rs b/src/datadogV2/model/model_gcp_integration_type.rs new file mode 100644 index 000000000..784dbf696 --- /dev/null +++ b/src/datadogV2/model/model_gcp_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GCPIntegrationType { + GCP, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GCPIntegrationType { + fn to_string(&self) -> String { + match self { + Self::GCP => String::from("GCP"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GCPIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GCPIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GCP" => Self::GCP, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_gcp_integration_update.rs b/src/datadogV2/model/model_gcp_integration_update.rs new file mode 100644 index 000000000..fdbc519a3 --- /dev/null +++ b/src/datadogV2/model/model_gcp_integration_update.rs @@ -0,0 +1,128 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GCPIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GCPIntegrationUpdate { + /// The definition of the `GCPCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `GCPIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GCPIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GCPIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::GCPIntegrationType) -> GCPIntegrationUpdate { + GCPIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::GCPCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GCPIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GCPIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for GCPIntegrationUpdateVisitor { + type Value = GCPIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GCPCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GCPIntegrationType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GCPIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GCPIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_gcp_service_account.rs b/src/datadogV2/model/model_gcp_service_account.rs new file mode 100644 index 000000000..3af20c8af --- /dev/null +++ b/src/datadogV2/model/model_gcp_service_account.rs @@ -0,0 +1,129 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GCPServiceAccount` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GCPServiceAccount { + /// The `GCPServiceAccount` `private_key`. + #[serde(rename = "private_key")] + pub private_key: String, + /// The `GCPServiceAccount` `service_account_email`. + #[serde(rename = "service_account_email")] + pub service_account_email: String, + /// The definition of the `GCPServiceAccount` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GCPServiceAccountCredentialType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GCPServiceAccount { + pub fn new( + private_key: String, + service_account_email: String, + type_: crate::datadogV2::model::GCPServiceAccountCredentialType, + ) -> GCPServiceAccount { + GCPServiceAccount { + private_key, + service_account_email, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GCPServiceAccount { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GCPServiceAccountVisitor; + impl<'a> Visitor<'a> for GCPServiceAccountVisitor { + type Value = GCPServiceAccount; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut private_key: Option = None; + let mut service_account_email: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "private_key" => { + private_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "service_account_email" => { + service_account_email = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GCPServiceAccountCredentialType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let private_key = + private_key.ok_or_else(|| M::Error::missing_field("private_key"))?; + let service_account_email = service_account_email + .ok_or_else(|| M::Error::missing_field("service_account_email"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GCPServiceAccount { + private_key, + service_account_email, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GCPServiceAccountVisitor) + } +} diff --git a/src/datadogV2/model/model_gcp_service_account_credential_type.rs b/src/datadogV2/model/model_gcp_service_account_credential_type.rs new file mode 100644 index 000000000..c9933041e --- /dev/null +++ b/src/datadogV2/model/model_gcp_service_account_credential_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GCPServiceAccountCredentialType { + GCPSERVICEACCOUNT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GCPServiceAccountCredentialType { + fn to_string(&self) -> String { + match self { + Self::GCPSERVICEACCOUNT => String::from("GCPServiceAccount"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GCPServiceAccountCredentialType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GCPServiceAccountCredentialType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GCPServiceAccount" => Self::GCPSERVICEACCOUNT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_gcp_service_account_update.rs b/src/datadogV2/model/model_gcp_service_account_update.rs new file mode 100644 index 000000000..49497bf7b --- /dev/null +++ b/src/datadogV2/model/model_gcp_service_account_update.rs @@ -0,0 +1,139 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GCPServiceAccount` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GCPServiceAccountUpdate { + /// The `GCPServiceAccountUpdate` `private_key`. + #[serde(rename = "private_key")] + pub private_key: Option, + /// The `GCPServiceAccountUpdate` `service_account_email`. + #[serde(rename = "service_account_email")] + pub service_account_email: Option, + /// The definition of the `GCPServiceAccount` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GCPServiceAccountCredentialType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GCPServiceAccountUpdate { + pub fn new( + type_: crate::datadogV2::model::GCPServiceAccountCredentialType, + ) -> GCPServiceAccountUpdate { + GCPServiceAccountUpdate { + private_key: None, + service_account_email: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn private_key(mut self, value: String) -> Self { + self.private_key = Some(value); + self + } + + pub fn service_account_email(mut self, value: String) -> Self { + self.service_account_email = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GCPServiceAccountUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GCPServiceAccountUpdateVisitor; + impl<'a> Visitor<'a> for GCPServiceAccountUpdateVisitor { + type Value = GCPServiceAccountUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut private_key: Option = None; + let mut service_account_email: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "private_key" => { + if v.is_null() { + continue; + } + private_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "service_account_email" => { + if v.is_null() { + continue; + } + service_account_email = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GCPServiceAccountCredentialType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GCPServiceAccountUpdate { + private_key, + service_account_email, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GCPServiceAccountUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_gemini_api_key.rs b/src/datadogV2/model/model_gemini_api_key.rs new file mode 100644 index 000000000..50fb1c514 --- /dev/null +++ b/src/datadogV2/model/model_gemini_api_key.rs @@ -0,0 +1,112 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GeminiAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GeminiAPIKey { + /// The `GeminiAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The definition of the `GeminiAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GeminiAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GeminiAPIKey { + pub fn new(api_key: String, type_: crate::datadogV2::model::GeminiAPIKeyType) -> GeminiAPIKey { + GeminiAPIKey { + api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GeminiAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GeminiAPIKeyVisitor; + impl<'a> Visitor<'a> for GeminiAPIKeyVisitor { + type Value = GeminiAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GeminiAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GeminiAPIKey { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GeminiAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_gemini_api_key_type.rs b/src/datadogV2/model/model_gemini_api_key_type.rs new file mode 100644 index 000000000..1b3857e0f --- /dev/null +++ b/src/datadogV2/model/model_gemini_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GeminiAPIKeyType { + GEMINIAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GeminiAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::GEMINIAPIKEY => String::from("GeminiAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GeminiAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GeminiAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GeminiAPIKey" => Self::GEMINIAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_gemini_api_key_update.rs b/src/datadogV2/model/model_gemini_api_key_update.rs new file mode 100644 index 000000000..00f514400 --- /dev/null +++ b/src/datadogV2/model/model_gemini_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GeminiAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GeminiAPIKeyUpdate { + /// The `GeminiAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The definition of the `GeminiAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GeminiAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GeminiAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::GeminiAPIKeyType) -> GeminiAPIKeyUpdate { + GeminiAPIKeyUpdate { + api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GeminiAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GeminiAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for GeminiAPIKeyUpdateVisitor { + type Value = GeminiAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GeminiAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GeminiAPIKeyUpdate { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GeminiAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_gemini_credentials.rs b/src/datadogV2/model/model_gemini_credentials.rs new file mode 100644 index 000000000..1da216a41 --- /dev/null +++ b/src/datadogV2/model/model_gemini_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GeminiCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GeminiCredentials { + GeminiAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GeminiCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(GeminiCredentials::GeminiAPIKey(_v)); + } + } + + return Ok(GeminiCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_gemini_credentials_update.rs b/src/datadogV2/model/model_gemini_credentials_update.rs new file mode 100644 index 000000000..09ac87ac0 --- /dev/null +++ b/src/datadogV2/model/model_gemini_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GeminiCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GeminiCredentialsUpdate { + GeminiAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GeminiCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(GeminiCredentialsUpdate::GeminiAPIKeyUpdate(_v)); + } + } + + return Ok(GeminiCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_gemini_integration.rs b/src/datadogV2/model/model_gemini_integration.rs new file mode 100644 index 000000000..ebb42764a --- /dev/null +++ b/src/datadogV2/model/model_gemini_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GeminiIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GeminiIntegration { + /// The definition of the `GeminiCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::GeminiCredentials, + /// The definition of the `GeminiIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GeminiIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GeminiIntegration { + pub fn new( + credentials: crate::datadogV2::model::GeminiCredentials, + type_: crate::datadogV2::model::GeminiIntegrationType, + ) -> GeminiIntegration { + GeminiIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GeminiIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GeminiIntegrationVisitor; + impl<'a> Visitor<'a> for GeminiIntegrationVisitor { + type Value = GeminiIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GeminiCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GeminiIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GeminiIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GeminiIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_gemini_integration_type.rs b/src/datadogV2/model/model_gemini_integration_type.rs new file mode 100644 index 000000000..7848ebb1d --- /dev/null +++ b/src/datadogV2/model/model_gemini_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GeminiIntegrationType { + GEMINI, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GeminiIntegrationType { + fn to_string(&self) -> String { + match self { + Self::GEMINI => String::from("Gemini"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GeminiIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GeminiIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Gemini" => Self::GEMINI, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_gemini_integration_update.rs b/src/datadogV2/model/model_gemini_integration_update.rs new file mode 100644 index 000000000..45aadfa5c --- /dev/null +++ b/src/datadogV2/model/model_gemini_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GeminiIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GeminiIntegrationUpdate { + /// The definition of the `GeminiCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `GeminiIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GeminiIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GeminiIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::GeminiIntegrationType) -> GeminiIntegrationUpdate { + GeminiIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::GeminiCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GeminiIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GeminiIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for GeminiIntegrationUpdateVisitor { + type Value = GeminiIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GeminiCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GeminiIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GeminiIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GeminiIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_gitlab_api_key.rs b/src/datadogV2/model/model_gitlab_api_key.rs new file mode 100644 index 000000000..a9847d19f --- /dev/null +++ b/src/datadogV2/model/model_gitlab_api_key.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GitlabAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GitlabAPIKey { + /// The `GitlabAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `GitlabAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GitlabAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GitlabAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::GitlabAPIKeyType, + ) -> GitlabAPIKey { + GitlabAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GitlabAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GitlabAPIKeyVisitor; + impl<'a> Visitor<'a> for GitlabAPIKeyVisitor { + type Value = GitlabAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GitlabAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GitlabAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GitlabAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_gitlab_api_key_type.rs b/src/datadogV2/model/model_gitlab_api_key_type.rs new file mode 100644 index 000000000..919c361fd --- /dev/null +++ b/src/datadogV2/model/model_gitlab_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GitlabAPIKeyType { + GITLABAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GitlabAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::GITLABAPIKEY => String::from("GitlabAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GitlabAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GitlabAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GitlabAPIKey" => Self::GITLABAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_gitlab_api_key_update.rs b/src/datadogV2/model/model_gitlab_api_key_update.rs new file mode 100644 index 000000000..06ea96dc6 --- /dev/null +++ b/src/datadogV2/model/model_gitlab_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GitlabAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GitlabAPIKeyUpdate { + /// The `GitlabAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `GitlabAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GitlabAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GitlabAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::GitlabAPIKeyType) -> GitlabAPIKeyUpdate { + GitlabAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GitlabAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GitlabAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for GitlabAPIKeyUpdateVisitor { + type Value = GitlabAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GitlabAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GitlabAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GitlabAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_gitlab_credentials.rs b/src/datadogV2/model/model_gitlab_credentials.rs new file mode 100644 index 000000000..5f03a38e7 --- /dev/null +++ b/src/datadogV2/model/model_gitlab_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GitlabCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GitlabCredentials { + GitlabAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GitlabCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(GitlabCredentials::GitlabAPIKey(_v)); + } + } + + return Ok(GitlabCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_gitlab_credentials_update.rs b/src/datadogV2/model/model_gitlab_credentials_update.rs new file mode 100644 index 000000000..f3db29ae4 --- /dev/null +++ b/src/datadogV2/model/model_gitlab_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GitlabCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GitlabCredentialsUpdate { + GitlabAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GitlabCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(GitlabCredentialsUpdate::GitlabAPIKeyUpdate(_v)); + } + } + + return Ok(GitlabCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_gitlab_integration.rs b/src/datadogV2/model/model_gitlab_integration.rs new file mode 100644 index 000000000..b51fbcf49 --- /dev/null +++ b/src/datadogV2/model/model_gitlab_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GitlabIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GitlabIntegration { + /// The definition of the `GitlabCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::GitlabCredentials, + /// The definition of the `GitlabIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GitlabIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GitlabIntegration { + pub fn new( + credentials: crate::datadogV2::model::GitlabCredentials, + type_: crate::datadogV2::model::GitlabIntegrationType, + ) -> GitlabIntegration { + GitlabIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GitlabIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GitlabIntegrationVisitor; + impl<'a> Visitor<'a> for GitlabIntegrationVisitor { + type Value = GitlabIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GitlabCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GitlabIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GitlabIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GitlabIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_gitlab_integration_type.rs b/src/datadogV2/model/model_gitlab_integration_type.rs new file mode 100644 index 000000000..08b15454a --- /dev/null +++ b/src/datadogV2/model/model_gitlab_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GitlabIntegrationType { + GITLAB, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GitlabIntegrationType { + fn to_string(&self) -> String { + match self { + Self::GITLAB => String::from("Gitlab"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GitlabIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GitlabIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Gitlab" => Self::GITLAB, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_gitlab_integration_update.rs b/src/datadogV2/model/model_gitlab_integration_update.rs new file mode 100644 index 000000000..1cf1b2066 --- /dev/null +++ b/src/datadogV2/model/model_gitlab_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GitlabIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GitlabIntegrationUpdate { + /// The definition of the `GitlabCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `GitlabIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GitlabIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GitlabIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::GitlabIntegrationType) -> GitlabIntegrationUpdate { + GitlabIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::GitlabCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GitlabIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GitlabIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for GitlabIntegrationUpdateVisitor { + type Value = GitlabIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GitlabCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GitlabIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GitlabIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GitlabIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_grey_noise_api_key.rs b/src/datadogV2/model/model_grey_noise_api_key.rs new file mode 100644 index 000000000..798d20694 --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_api_key.rs @@ -0,0 +1,113 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GreyNoiseAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GreyNoiseAPIKey { + /// The `GreyNoiseAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The definition of the `GreyNoiseAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GreyNoiseAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GreyNoiseAPIKey { + pub fn new( + api_key: String, + type_: crate::datadogV2::model::GreyNoiseAPIKeyType, + ) -> GreyNoiseAPIKey { + GreyNoiseAPIKey { + api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GreyNoiseAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GreyNoiseAPIKeyVisitor; + impl<'a> Visitor<'a> for GreyNoiseAPIKeyVisitor { + type Value = GreyNoiseAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GreyNoiseAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GreyNoiseAPIKey { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GreyNoiseAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_grey_noise_api_key_type.rs b/src/datadogV2/model/model_grey_noise_api_key_type.rs new file mode 100644 index 000000000..88f3234bf --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GreyNoiseAPIKeyType { + GREYNOISEAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GreyNoiseAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::GREYNOISEAPIKEY => String::from("GreyNoiseAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GreyNoiseAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GreyNoiseAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GreyNoiseAPIKey" => Self::GREYNOISEAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_grey_noise_api_key_update.rs b/src/datadogV2/model/model_grey_noise_api_key_update.rs new file mode 100644 index 000000000..2f3b05ed6 --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_api_key_update.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GreyNoiseAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GreyNoiseAPIKeyUpdate { + /// The `GreyNoiseAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The definition of the `GreyNoiseAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GreyNoiseAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GreyNoiseAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::GreyNoiseAPIKeyType) -> GreyNoiseAPIKeyUpdate { + GreyNoiseAPIKeyUpdate { + api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GreyNoiseAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GreyNoiseAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for GreyNoiseAPIKeyUpdateVisitor { + type Value = GreyNoiseAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GreyNoiseAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GreyNoiseAPIKeyUpdate { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GreyNoiseAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_grey_noise_credentials.rs b/src/datadogV2/model/model_grey_noise_credentials.rs new file mode 100644 index 000000000..b4e595e41 --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GreyNoiseCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GreyNoiseCredentials { + GreyNoiseAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GreyNoiseCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(GreyNoiseCredentials::GreyNoiseAPIKey(_v)); + } + } + + return Ok(GreyNoiseCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_grey_noise_credentials_update.rs b/src/datadogV2/model/model_grey_noise_credentials_update.rs new file mode 100644 index 000000000..6f91f3a91 --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `GreyNoiseCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum GreyNoiseCredentialsUpdate { + GreyNoiseAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for GreyNoiseCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(GreyNoiseCredentialsUpdate::GreyNoiseAPIKeyUpdate(_v)); + } + } + + return Ok(GreyNoiseCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_grey_noise_integration.rs b/src/datadogV2/model/model_grey_noise_integration.rs new file mode 100644 index 000000000..99b22424c --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GreyNoiseIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GreyNoiseIntegration { + /// The definition of the `GreyNoiseCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::GreyNoiseCredentials, + /// The definition of the `GreyNoiseIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GreyNoiseIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GreyNoiseIntegration { + pub fn new( + credentials: crate::datadogV2::model::GreyNoiseCredentials, + type_: crate::datadogV2::model::GreyNoiseIntegrationType, + ) -> GreyNoiseIntegration { + GreyNoiseIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GreyNoiseIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GreyNoiseIntegrationVisitor; + impl<'a> Visitor<'a> for GreyNoiseIntegrationVisitor { + type Value = GreyNoiseIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GreyNoiseCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GreyNoiseIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GreyNoiseIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GreyNoiseIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_grey_noise_integration_type.rs b/src/datadogV2/model/model_grey_noise_integration_type.rs new file mode 100644 index 000000000..9bc89a361 --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GreyNoiseIntegrationType { + GREYNOISE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GreyNoiseIntegrationType { + fn to_string(&self) -> String { + match self { + Self::GREYNOISE => String::from("GreyNoise"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GreyNoiseIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GreyNoiseIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GreyNoise" => Self::GREYNOISE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_grey_noise_integration_update.rs b/src/datadogV2/model/model_grey_noise_integration_update.rs new file mode 100644 index 000000000..4836f9922 --- /dev/null +++ b/src/datadogV2/model/model_grey_noise_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `GreyNoiseIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GreyNoiseIntegrationUpdate { + /// The definition of the `GreyNoiseCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `GreyNoiseIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GreyNoiseIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GreyNoiseIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::GreyNoiseIntegrationType, + ) -> GreyNoiseIntegrationUpdate { + GreyNoiseIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::GreyNoiseCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GreyNoiseIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GreyNoiseIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for GreyNoiseIntegrationUpdateVisitor { + type Value = GreyNoiseIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::GreyNoiseCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GreyNoiseIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GreyNoiseIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GreyNoiseIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_launch_darkly_api_key.rs b/src/datadogV2/model/model_launch_darkly_api_key.rs new file mode 100644 index 000000000..25bbe14cf --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_api_key.rs @@ -0,0 +1,113 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `LaunchDarklyAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LaunchDarklyAPIKey { + /// The `LaunchDarklyAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `LaunchDarklyAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LaunchDarklyAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LaunchDarklyAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::LaunchDarklyAPIKeyType, + ) -> LaunchDarklyAPIKey { + LaunchDarklyAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LaunchDarklyAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LaunchDarklyAPIKeyVisitor; + impl<'a> Visitor<'a> for LaunchDarklyAPIKeyVisitor { + type Value = LaunchDarklyAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LaunchDarklyAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LaunchDarklyAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LaunchDarklyAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_launch_darkly_api_key_type.rs b/src/datadogV2/model/model_launch_darkly_api_key_type.rs new file mode 100644 index 000000000..6e8ee8108 --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LaunchDarklyAPIKeyType { + LAUNCHDARKLYAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LaunchDarklyAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::LAUNCHDARKLYAPIKEY => String::from("LaunchDarklyAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LaunchDarklyAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LaunchDarklyAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "LaunchDarklyAPIKey" => Self::LAUNCHDARKLYAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_launch_darkly_api_key_update.rs b/src/datadogV2/model/model_launch_darkly_api_key_update.rs new file mode 100644 index 000000000..e068dd1e6 --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_api_key_update.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `LaunchDarklyAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LaunchDarklyAPIKeyUpdate { + /// The `LaunchDarklyAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `LaunchDarklyAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LaunchDarklyAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LaunchDarklyAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::LaunchDarklyAPIKeyType) -> LaunchDarklyAPIKeyUpdate { + LaunchDarklyAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LaunchDarklyAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LaunchDarklyAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for LaunchDarklyAPIKeyUpdateVisitor { + type Value = LaunchDarklyAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LaunchDarklyAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LaunchDarklyAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LaunchDarklyAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_launch_darkly_credentials.rs b/src/datadogV2/model/model_launch_darkly_credentials.rs new file mode 100644 index 000000000..e157595e2 --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `LaunchDarklyCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum LaunchDarklyCredentials { + LaunchDarklyAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for LaunchDarklyCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(LaunchDarklyCredentials::LaunchDarklyAPIKey(_v)); + } + } + + return Ok(LaunchDarklyCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_launch_darkly_credentials_update.rs b/src/datadogV2/model/model_launch_darkly_credentials_update.rs new file mode 100644 index 000000000..0b32059ff --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_credentials_update.rs @@ -0,0 +1,34 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `LaunchDarklyCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum LaunchDarklyCredentialsUpdate { + LaunchDarklyAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for LaunchDarklyCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(LaunchDarklyCredentialsUpdate::LaunchDarklyAPIKeyUpdate(_v)); + } + } + + return Ok(LaunchDarklyCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_launch_darkly_integration.rs b/src/datadogV2/model/model_launch_darkly_integration.rs new file mode 100644 index 000000000..2fd89cc27 --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_integration.rs @@ -0,0 +1,124 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `LaunchDarklyIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LaunchDarklyIntegration { + /// The definition of the `LaunchDarklyCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::LaunchDarklyCredentials, + /// The definition of the `LaunchDarklyIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LaunchDarklyIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LaunchDarklyIntegration { + pub fn new( + credentials: crate::datadogV2::model::LaunchDarklyCredentials, + type_: crate::datadogV2::model::LaunchDarklyIntegrationType, + ) -> LaunchDarklyIntegration { + LaunchDarklyIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LaunchDarklyIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LaunchDarklyIntegrationVisitor; + impl<'a> Visitor<'a> for LaunchDarklyIntegrationVisitor { + type Value = LaunchDarklyIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::LaunchDarklyCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LaunchDarklyIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LaunchDarklyIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LaunchDarklyIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_launch_darkly_integration_type.rs b/src/datadogV2/model/model_launch_darkly_integration_type.rs new file mode 100644 index 000000000..626c233f5 --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LaunchDarklyIntegrationType { + LAUNCHDARKLY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LaunchDarklyIntegrationType { + fn to_string(&self) -> String { + match self { + Self::LAUNCHDARKLY => String::from("LaunchDarkly"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LaunchDarklyIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LaunchDarklyIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "LaunchDarkly" => Self::LAUNCHDARKLY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_launch_darkly_integration_update.rs b/src/datadogV2/model/model_launch_darkly_integration_update.rs new file mode 100644 index 000000000..af1822886 --- /dev/null +++ b/src/datadogV2/model/model_launch_darkly_integration_update.rs @@ -0,0 +1,133 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `LaunchDarklyIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LaunchDarklyIntegrationUpdate { + /// The definition of the `LaunchDarklyCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `LaunchDarklyIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LaunchDarklyIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LaunchDarklyIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::LaunchDarklyIntegrationType, + ) -> LaunchDarklyIntegrationUpdate { + LaunchDarklyIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::LaunchDarklyCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LaunchDarklyIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LaunchDarklyIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for LaunchDarklyIntegrationUpdateVisitor { + type Value = LaunchDarklyIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option< + crate::datadogV2::model::LaunchDarklyCredentialsUpdate, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::LaunchDarklyCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LaunchDarklyIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LaunchDarklyIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LaunchDarklyIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_notion_api_key.rs b/src/datadogV2/model/model_notion_api_key.rs new file mode 100644 index 000000000..025edd3d1 --- /dev/null +++ b/src/datadogV2/model/model_notion_api_key.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `NotionAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct NotionAPIKey { + /// The `NotionAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `NotionAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::NotionAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl NotionAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::NotionAPIKeyType, + ) -> NotionAPIKey { + NotionAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for NotionAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct NotionAPIKeyVisitor; + impl<'a> Visitor<'a> for NotionAPIKeyVisitor { + type Value = NotionAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::NotionAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = NotionAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(NotionAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_notion_api_key_type.rs b/src/datadogV2/model/model_notion_api_key_type.rs new file mode 100644 index 000000000..b5d8cddfb --- /dev/null +++ b/src/datadogV2/model/model_notion_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum NotionAPIKeyType { + NOTIONAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for NotionAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::NOTIONAPIKEY => String::from("NotionAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for NotionAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for NotionAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "NotionAPIKey" => Self::NOTIONAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_notion_api_key_update.rs b/src/datadogV2/model/model_notion_api_key_update.rs new file mode 100644 index 000000000..7366c3b7c --- /dev/null +++ b/src/datadogV2/model/model_notion_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `NotionAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct NotionAPIKeyUpdate { + /// The `NotionAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `NotionAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::NotionAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl NotionAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::NotionAPIKeyType) -> NotionAPIKeyUpdate { + NotionAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for NotionAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct NotionAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for NotionAPIKeyUpdateVisitor { + type Value = NotionAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::NotionAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = NotionAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(NotionAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_notion_credentials.rs b/src/datadogV2/model/model_notion_credentials.rs new file mode 100644 index 000000000..86a4f0a4a --- /dev/null +++ b/src/datadogV2/model/model_notion_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `NotionCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum NotionCredentials { + NotionAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for NotionCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(NotionCredentials::NotionAPIKey(_v)); + } + } + + return Ok(NotionCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_notion_credentials_update.rs b/src/datadogV2/model/model_notion_credentials_update.rs new file mode 100644 index 000000000..000f1a24b --- /dev/null +++ b/src/datadogV2/model/model_notion_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `NotionCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum NotionCredentialsUpdate { + NotionAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for NotionCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(NotionCredentialsUpdate::NotionAPIKeyUpdate(_v)); + } + } + + return Ok(NotionCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_notion_integration.rs b/src/datadogV2/model/model_notion_integration.rs new file mode 100644 index 000000000..cd8aba656 --- /dev/null +++ b/src/datadogV2/model/model_notion_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `NotionIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct NotionIntegration { + /// The definition of the `NotionCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::NotionCredentials, + /// The definition of the `NotionIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::NotionIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl NotionIntegration { + pub fn new( + credentials: crate::datadogV2::model::NotionCredentials, + type_: crate::datadogV2::model::NotionIntegrationType, + ) -> NotionIntegration { + NotionIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for NotionIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct NotionIntegrationVisitor; + impl<'a> Visitor<'a> for NotionIntegrationVisitor { + type Value = NotionIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::NotionCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::NotionIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = NotionIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(NotionIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_notion_integration_type.rs b/src/datadogV2/model/model_notion_integration_type.rs new file mode 100644 index 000000000..c565126ed --- /dev/null +++ b/src/datadogV2/model/model_notion_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum NotionIntegrationType { + NOTION, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for NotionIntegrationType { + fn to_string(&self) -> String { + match self { + Self::NOTION => String::from("Notion"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for NotionIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for NotionIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Notion" => Self::NOTION, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_notion_integration_update.rs b/src/datadogV2/model/model_notion_integration_update.rs new file mode 100644 index 000000000..8282a2704 --- /dev/null +++ b/src/datadogV2/model/model_notion_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `NotionIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct NotionIntegrationUpdate { + /// The definition of the `NotionCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `NotionIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::NotionIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl NotionIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::NotionIntegrationType) -> NotionIntegrationUpdate { + NotionIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::NotionCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for NotionIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct NotionIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for NotionIntegrationUpdateVisitor { + type Value = NotionIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::NotionCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::NotionIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = NotionIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(NotionIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_okta_api_token.rs b/src/datadogV2/model/model_okta_api_token.rs new file mode 100644 index 000000000..2719a4151 --- /dev/null +++ b/src/datadogV2/model/model_okta_api_token.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OktaAPIToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OktaAPIToken { + /// The `OktaAPIToken` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The `OktaAPIToken` `domain`. + #[serde(rename = "domain")] + pub domain: String, + /// The definition of the `OktaAPIToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OktaAPITokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OktaAPIToken { + pub fn new( + api_token: String, + domain: String, + type_: crate::datadogV2::model::OktaAPITokenType, + ) -> OktaAPIToken { + OktaAPIToken { + api_token, + domain, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OktaAPIToken { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OktaAPITokenVisitor; + impl<'a> Visitor<'a> for OktaAPITokenVisitor { + type Value = OktaAPIToken; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut domain: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "domain" => { + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OktaAPITokenType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OktaAPIToken { + api_token, + domain, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OktaAPITokenVisitor) + } +} diff --git a/src/datadogV2/model/model_okta_api_token_type.rs b/src/datadogV2/model/model_okta_api_token_type.rs new file mode 100644 index 000000000..c7d50faec --- /dev/null +++ b/src/datadogV2/model/model_okta_api_token_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum OktaAPITokenType { + OKTAAPITOKEN, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for OktaAPITokenType { + fn to_string(&self) -> String { + match self { + Self::OKTAAPITOKEN => String::from("OktaAPIToken"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for OktaAPITokenType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for OktaAPITokenType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "OktaAPIToken" => Self::OKTAAPITOKEN, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_okta_api_token_update.rs b/src/datadogV2/model/model_okta_api_token_update.rs new file mode 100644 index 000000000..669cf126b --- /dev/null +++ b/src/datadogV2/model/model_okta_api_token_update.rs @@ -0,0 +1,136 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OktaAPIToken` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OktaAPITokenUpdate { + /// The `OktaAPITokenUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The `OktaAPITokenUpdate` `domain`. + #[serde(rename = "domain")] + pub domain: Option, + /// The definition of the `OktaAPIToken` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OktaAPITokenType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OktaAPITokenUpdate { + pub fn new(type_: crate::datadogV2::model::OktaAPITokenType) -> OktaAPITokenUpdate { + OktaAPITokenUpdate { + api_token: None, + domain: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OktaAPITokenUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OktaAPITokenUpdateVisitor; + impl<'a> Visitor<'a> for OktaAPITokenUpdateVisitor { + type Value = OktaAPITokenUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut domain: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OktaAPITokenType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OktaAPITokenUpdate { + api_token, + domain, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OktaAPITokenUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_okta_credentials.rs b/src/datadogV2/model/model_okta_credentials.rs new file mode 100644 index 000000000..a7d3315c8 --- /dev/null +++ b/src/datadogV2/model/model_okta_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `OktaCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum OktaCredentials { + OktaAPIToken(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for OktaCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(OktaCredentials::OktaAPIToken(_v)); + } + } + + return Ok(OktaCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_okta_credentials_update.rs b/src/datadogV2/model/model_okta_credentials_update.rs new file mode 100644 index 000000000..d491d2a96 --- /dev/null +++ b/src/datadogV2/model/model_okta_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `OktaCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum OktaCredentialsUpdate { + OktaAPITokenUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for OktaCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(OktaCredentialsUpdate::OktaAPITokenUpdate(_v)); + } + } + + return Ok(OktaCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_okta_integration.rs b/src/datadogV2/model/model_okta_integration.rs new file mode 100644 index 000000000..e0165f862 --- /dev/null +++ b/src/datadogV2/model/model_okta_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OktaIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OktaIntegration { + /// The definition of the `OktaCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::OktaCredentials, + /// The definition of the `OktaIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OktaIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OktaIntegration { + pub fn new( + credentials: crate::datadogV2::model::OktaCredentials, + type_: crate::datadogV2::model::OktaIntegrationType, + ) -> OktaIntegration { + OktaIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OktaIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OktaIntegrationVisitor; + impl<'a> Visitor<'a> for OktaIntegrationVisitor { + type Value = OktaIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::OktaCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OktaIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OktaIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OktaIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_okta_integration_type.rs b/src/datadogV2/model/model_okta_integration_type.rs new file mode 100644 index 000000000..0843d8d9d --- /dev/null +++ b/src/datadogV2/model/model_okta_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum OktaIntegrationType { + OKTA, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for OktaIntegrationType { + fn to_string(&self) -> String { + match self { + Self::OKTA => String::from("Okta"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for OktaIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for OktaIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Okta" => Self::OKTA, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_okta_integration_update.rs b/src/datadogV2/model/model_okta_integration_update.rs new file mode 100644 index 000000000..0eeed338f --- /dev/null +++ b/src/datadogV2/model/model_okta_integration_update.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OktaIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OktaIntegrationUpdate { + /// The definition of the `OktaCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `OktaIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OktaIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OktaIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::OktaIntegrationType) -> OktaIntegrationUpdate { + OktaIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::OktaCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OktaIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OktaIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for OktaIntegrationUpdateVisitor { + type Value = OktaIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::OktaCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OktaIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OktaIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OktaIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_open_ai_credentials.rs b/src/datadogV2/model/model_open_ai_credentials.rs new file mode 100644 index 000000000..2f4b2ac46 --- /dev/null +++ b/src/datadogV2/model/model_open_ai_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `OpenAICredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum OpenAICredentials { + OpenAIAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for OpenAICredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(OpenAICredentials::OpenAIAPIKey(_v)); + } + } + + return Ok(OpenAICredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_open_ai_credentials_update.rs b/src/datadogV2/model/model_open_ai_credentials_update.rs new file mode 100644 index 000000000..f894fc727 --- /dev/null +++ b/src/datadogV2/model/model_open_ai_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `OpenAICredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum OpenAICredentialsUpdate { + OpenAIAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for OpenAICredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(OpenAICredentialsUpdate::OpenAIAPIKeyUpdate(_v)); + } + } + + return Ok(OpenAICredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_open_ai_integration.rs b/src/datadogV2/model/model_open_ai_integration.rs new file mode 100644 index 000000000..7abcc9afe --- /dev/null +++ b/src/datadogV2/model/model_open_ai_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OpenAIIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OpenAIIntegration { + /// The definition of the `OpenAICredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::OpenAICredentials, + /// The definition of the `OpenAIIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OpenAIIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OpenAIIntegration { + pub fn new( + credentials: crate::datadogV2::model::OpenAICredentials, + type_: crate::datadogV2::model::OpenAIIntegrationType, + ) -> OpenAIIntegration { + OpenAIIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OpenAIIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OpenAIIntegrationVisitor; + impl<'a> Visitor<'a> for OpenAIIntegrationVisitor { + type Value = OpenAIIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::OpenAICredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OpenAIIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OpenAIIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OpenAIIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_open_ai_integration_type.rs b/src/datadogV2/model/model_open_ai_integration_type.rs new file mode 100644 index 000000000..9c4ec0154 --- /dev/null +++ b/src/datadogV2/model/model_open_ai_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum OpenAIIntegrationType { + OPENAI, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for OpenAIIntegrationType { + fn to_string(&self) -> String { + match self { + Self::OPENAI => String::from("OpenAI"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for OpenAIIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for OpenAIIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "OpenAI" => Self::OPENAI, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_open_ai_integration_update.rs b/src/datadogV2/model/model_open_ai_integration_update.rs new file mode 100644 index 000000000..c2f2a9337 --- /dev/null +++ b/src/datadogV2/model/model_open_ai_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OpenAIIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OpenAIIntegrationUpdate { + /// The definition of the `OpenAICredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `OpenAIIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OpenAIIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OpenAIIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::OpenAIIntegrationType) -> OpenAIIntegrationUpdate { + OpenAIIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::OpenAICredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OpenAIIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OpenAIIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for OpenAIIntegrationUpdateVisitor { + type Value = OpenAIIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::OpenAICredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OpenAIIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OpenAIIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OpenAIIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_open_aiapi_key.rs b/src/datadogV2/model/model_open_aiapi_key.rs new file mode 100644 index 000000000..765233033 --- /dev/null +++ b/src/datadogV2/model/model_open_aiapi_key.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OpenAIAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OpenAIAPIKey { + /// The `OpenAIAPIKey` `api_token`. + #[serde(rename = "api_token")] + pub api_token: String, + /// The definition of the `OpenAIAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OpenAIAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OpenAIAPIKey { + pub fn new( + api_token: String, + type_: crate::datadogV2::model::OpenAIAPIKeyType, + ) -> OpenAIAPIKey { + OpenAIAPIKey { + api_token, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OpenAIAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OpenAIAPIKeyVisitor; + impl<'a> Visitor<'a> for OpenAIAPIKeyVisitor { + type Value = OpenAIAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OpenAIAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OpenAIAPIKey { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OpenAIAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_open_aiapi_key_type.rs b/src/datadogV2/model/model_open_aiapi_key_type.rs new file mode 100644 index 000000000..d10048c88 --- /dev/null +++ b/src/datadogV2/model/model_open_aiapi_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum OpenAIAPIKeyType { + OPENAIAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for OpenAIAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::OPENAIAPIKEY => String::from("OpenAIAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for OpenAIAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for OpenAIAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "OpenAIAPIKey" => Self::OPENAIAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_open_aiapi_key_update.rs b/src/datadogV2/model/model_open_aiapi_key_update.rs new file mode 100644 index 000000000..0e030f7c7 --- /dev/null +++ b/src/datadogV2/model/model_open_aiapi_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `OpenAIAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct OpenAIAPIKeyUpdate { + /// The `OpenAIAPIKeyUpdate` `api_token`. + #[serde(rename = "api_token")] + pub api_token: Option, + /// The definition of the `OpenAIAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::OpenAIAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl OpenAIAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::OpenAIAPIKeyType) -> OpenAIAPIKeyUpdate { + OpenAIAPIKeyUpdate { + api_token: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_token(mut self, value: String) -> Self { + self.api_token = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for OpenAIAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct OpenAIAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for OpenAIAPIKeyUpdateVisitor { + type Value = OpenAIAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_token: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_token" => { + if v.is_null() { + continue; + } + api_token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::OpenAIAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = OpenAIAPIKeyUpdate { + api_token, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(OpenAIAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_service_now_basic_auth.rs b/src/datadogV2/model/model_service_now_basic_auth.rs new file mode 100644 index 000000000..8f101026f --- /dev/null +++ b/src/datadogV2/model/model_service_now_basic_auth.rs @@ -0,0 +1,135 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ServiceNowBasicAuth` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ServiceNowBasicAuth { + /// The `ServiceNowBasicAuth` `instance`. + #[serde(rename = "instance")] + pub instance: String, + /// The `ServiceNowBasicAuth` `password`. + #[serde(rename = "password")] + pub password: String, + /// The definition of the `ServiceNowBasicAuth` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ServiceNowBasicAuthType, + /// The `ServiceNowBasicAuth` `username`. + #[serde(rename = "username")] + pub username: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ServiceNowBasicAuth { + pub fn new( + instance: String, + password: String, + type_: crate::datadogV2::model::ServiceNowBasicAuthType, + username: String, + ) -> ServiceNowBasicAuth { + ServiceNowBasicAuth { + instance, + password, + type_, + username, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ServiceNowBasicAuth { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ServiceNowBasicAuthVisitor; + impl<'a> Visitor<'a> for ServiceNowBasicAuthVisitor { + type Value = ServiceNowBasicAuth; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut instance: Option = None; + let mut password: Option = None; + let mut type_: Option = None; + let mut username: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "instance" => { + instance = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "password" => { + password = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ServiceNowBasicAuthType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + "username" => { + username = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let instance = instance.ok_or_else(|| M::Error::missing_field("instance"))?; + let password = password.ok_or_else(|| M::Error::missing_field("password"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + let username = username.ok_or_else(|| M::Error::missing_field("username"))?; + + let content = ServiceNowBasicAuth { + instance, + password, + type_, + username, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ServiceNowBasicAuthVisitor) + } +} diff --git a/src/datadogV2/model/model_service_now_basic_auth_type.rs b/src/datadogV2/model/model_service_now_basic_auth_type.rs new file mode 100644 index 000000000..9e256fbc8 --- /dev/null +++ b/src/datadogV2/model/model_service_now_basic_auth_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ServiceNowBasicAuthType { + SERVICENOWBASICAUTH, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ServiceNowBasicAuthType { + fn to_string(&self) -> String { + match self { + Self::SERVICENOWBASICAUTH => String::from("ServiceNowBasicAuth"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ServiceNowBasicAuthType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ServiceNowBasicAuthType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ServiceNowBasicAuth" => Self::SERVICENOWBASICAUTH, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_service_now_basic_auth_update.rs b/src/datadogV2/model/model_service_now_basic_auth_update.rs new file mode 100644 index 000000000..7488c2c1c --- /dev/null +++ b/src/datadogV2/model/model_service_now_basic_auth_update.rs @@ -0,0 +1,153 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ServiceNowBasicAuth` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ServiceNowBasicAuthUpdate { + /// The `ServiceNowBasicAuthUpdate` `instance`. + #[serde(rename = "instance")] + pub instance: Option, + /// The `ServiceNowBasicAuthUpdate` `password`. + #[serde(rename = "password")] + pub password: Option, + /// The definition of the `ServiceNowBasicAuth` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ServiceNowBasicAuthType, + /// The `ServiceNowBasicAuthUpdate` `username`. + #[serde(rename = "username")] + pub username: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ServiceNowBasicAuthUpdate { + pub fn new( + type_: crate::datadogV2::model::ServiceNowBasicAuthType, + ) -> ServiceNowBasicAuthUpdate { + ServiceNowBasicAuthUpdate { + instance: None, + password: None, + type_, + username: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn instance(mut self, value: String) -> Self { + self.instance = Some(value); + self + } + + pub fn password(mut self, value: String) -> Self { + self.password = Some(value); + self + } + + pub fn username(mut self, value: String) -> Self { + self.username = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ServiceNowBasicAuthUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ServiceNowBasicAuthUpdateVisitor; + impl<'a> Visitor<'a> for ServiceNowBasicAuthUpdateVisitor { + type Value = ServiceNowBasicAuthUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut instance: Option = None; + let mut password: Option = None; + let mut type_: Option = None; + let mut username: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "instance" => { + if v.is_null() { + continue; + } + instance = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "password" => { + if v.is_null() { + continue; + } + password = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ServiceNowBasicAuthType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + "username" => { + if v.is_null() { + continue; + } + username = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ServiceNowBasicAuthUpdate { + instance, + password, + type_, + username, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ServiceNowBasicAuthUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_service_now_credentials.rs b/src/datadogV2/model/model_service_now_credentials.rs new file mode 100644 index 000000000..c1a19d101 --- /dev/null +++ b/src/datadogV2/model/model_service_now_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `ServiceNowCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ServiceNowCredentials { + ServiceNowBasicAuth(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ServiceNowCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(ServiceNowCredentials::ServiceNowBasicAuth(_v)); + } + } + + return Ok(ServiceNowCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_service_now_credentials_update.rs b/src/datadogV2/model/model_service_now_credentials_update.rs new file mode 100644 index 000000000..6f2cbfed5 --- /dev/null +++ b/src/datadogV2/model/model_service_now_credentials_update.rs @@ -0,0 +1,34 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `ServiceNowCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ServiceNowCredentialsUpdate { + ServiceNowBasicAuthUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ServiceNowCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ServiceNowCredentialsUpdate::ServiceNowBasicAuthUpdate(_v)); + } + } + + return Ok(ServiceNowCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_service_now_integration.rs b/src/datadogV2/model/model_service_now_integration.rs new file mode 100644 index 000000000..ebfcd9301 --- /dev/null +++ b/src/datadogV2/model/model_service_now_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ServiceNowIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ServiceNowIntegration { + /// The definition of the `ServiceNowCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::ServiceNowCredentials, + /// The definition of the `ServiceNowIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ServiceNowIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ServiceNowIntegration { + pub fn new( + credentials: crate::datadogV2::model::ServiceNowCredentials, + type_: crate::datadogV2::model::ServiceNowIntegrationType, + ) -> ServiceNowIntegration { + ServiceNowIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ServiceNowIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ServiceNowIntegrationVisitor; + impl<'a> Visitor<'a> for ServiceNowIntegrationVisitor { + type Value = ServiceNowIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::ServiceNowCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ServiceNowIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ServiceNowIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ServiceNowIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_service_now_integration_type.rs b/src/datadogV2/model/model_service_now_integration_type.rs new file mode 100644 index 000000000..703675025 --- /dev/null +++ b/src/datadogV2/model/model_service_now_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ServiceNowIntegrationType { + SERVICENOW, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ServiceNowIntegrationType { + fn to_string(&self) -> String { + match self { + Self::SERVICENOW => String::from("ServiceNow"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ServiceNowIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ServiceNowIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ServiceNow" => Self::SERVICENOW, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_service_now_integration_update.rs b/src/datadogV2/model/model_service_now_integration_update.rs new file mode 100644 index 000000000..66de1dea5 --- /dev/null +++ b/src/datadogV2/model/model_service_now_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `ServiceNowIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ServiceNowIntegrationUpdate { + /// The definition of the `ServiceNowCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `ServiceNowIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ServiceNowIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ServiceNowIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::ServiceNowIntegrationType, + ) -> ServiceNowIntegrationUpdate { + ServiceNowIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::ServiceNowCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ServiceNowIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ServiceNowIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for ServiceNowIntegrationUpdateVisitor { + type Value = ServiceNowIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::ServiceNowCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ServiceNowIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ServiceNowIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ServiceNowIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_split_api_key.rs b/src/datadogV2/model/model_split_api_key.rs new file mode 100644 index 000000000..0e2a5ff5e --- /dev/null +++ b/src/datadogV2/model/model_split_api_key.rs @@ -0,0 +1,112 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `SplitAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SplitAPIKey { + /// The `SplitAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The definition of the `SplitAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SplitAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SplitAPIKey { + pub fn new(api_key: String, type_: crate::datadogV2::model::SplitAPIKeyType) -> SplitAPIKey { + SplitAPIKey { + api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SplitAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SplitAPIKeyVisitor; + impl<'a> Visitor<'a> for SplitAPIKeyVisitor { + type Value = SplitAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SplitAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SplitAPIKey { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SplitAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_split_api_key_type.rs b/src/datadogV2/model/model_split_api_key_type.rs new file mode 100644 index 000000000..2ee7c6bf4 --- /dev/null +++ b/src/datadogV2/model/model_split_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SplitAPIKeyType { + SPLITAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SplitAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::SPLITAPIKEY => String::from("SplitAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SplitAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for SplitAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "SplitAPIKey" => Self::SPLITAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_split_api_key_update.rs b/src/datadogV2/model/model_split_api_key_update.rs new file mode 100644 index 000000000..f71fb235c --- /dev/null +++ b/src/datadogV2/model/model_split_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `SplitAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SplitAPIKeyUpdate { + /// The `SplitAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The definition of the `SplitAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SplitAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SplitAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::SplitAPIKeyType) -> SplitAPIKeyUpdate { + SplitAPIKeyUpdate { + api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SplitAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SplitAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for SplitAPIKeyUpdateVisitor { + type Value = SplitAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SplitAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SplitAPIKeyUpdate { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SplitAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_split_credentials.rs b/src/datadogV2/model/model_split_credentials.rs new file mode 100644 index 000000000..b39f97886 --- /dev/null +++ b/src/datadogV2/model/model_split_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `SplitCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum SplitCredentials { + SplitAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for SplitCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(SplitCredentials::SplitAPIKey(_v)); + } + } + + return Ok(SplitCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_split_credentials_update.rs b/src/datadogV2/model/model_split_credentials_update.rs new file mode 100644 index 000000000..486c8259f --- /dev/null +++ b/src/datadogV2/model/model_split_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `SplitCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum SplitCredentialsUpdate { + SplitAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for SplitCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(SplitCredentialsUpdate::SplitAPIKeyUpdate(_v)); + } + } + + return Ok(SplitCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_split_integration.rs b/src/datadogV2/model/model_split_integration.rs new file mode 100644 index 000000000..1e640c755 --- /dev/null +++ b/src/datadogV2/model/model_split_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `SplitIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SplitIntegration { + /// The definition of the `SplitCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::SplitCredentials, + /// The definition of the `SplitIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SplitIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SplitIntegration { + pub fn new( + credentials: crate::datadogV2::model::SplitCredentials, + type_: crate::datadogV2::model::SplitIntegrationType, + ) -> SplitIntegration { + SplitIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SplitIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SplitIntegrationVisitor; + impl<'a> Visitor<'a> for SplitIntegrationVisitor { + type Value = SplitIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::SplitCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SplitIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SplitIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SplitIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_split_integration_type.rs b/src/datadogV2/model/model_split_integration_type.rs new file mode 100644 index 000000000..e1def0f56 --- /dev/null +++ b/src/datadogV2/model/model_split_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SplitIntegrationType { + SPLIT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SplitIntegrationType { + fn to_string(&self) -> String { + match self { + Self::SPLIT => String::from("Split"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SplitIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for SplitIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Split" => Self::SPLIT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_split_integration_update.rs b/src/datadogV2/model/model_split_integration_update.rs new file mode 100644 index 000000000..0f8ac24ac --- /dev/null +++ b/src/datadogV2/model/model_split_integration_update.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `SplitIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SplitIntegrationUpdate { + /// The definition of the `SplitCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `SplitIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SplitIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SplitIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::SplitIntegrationType) -> SplitIntegrationUpdate { + SplitIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::SplitCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SplitIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SplitIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for SplitIntegrationUpdateVisitor { + type Value = SplitIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::SplitCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SplitIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SplitIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SplitIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_statsig_api_key.rs b/src/datadogV2/model/model_statsig_api_key.rs new file mode 100644 index 000000000..2bb936094 --- /dev/null +++ b/src/datadogV2/model/model_statsig_api_key.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `StatsigAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct StatsigAPIKey { + /// The `StatsigAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The definition of the `StatsigAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::StatsigAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl StatsigAPIKey { + pub fn new( + api_key: String, + type_: crate::datadogV2::model::StatsigAPIKeyType, + ) -> StatsigAPIKey { + StatsigAPIKey { + api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for StatsigAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct StatsigAPIKeyVisitor; + impl<'a> Visitor<'a> for StatsigAPIKeyVisitor { + type Value = StatsigAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::StatsigAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = StatsigAPIKey { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(StatsigAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_statsig_api_key_type.rs b/src/datadogV2/model/model_statsig_api_key_type.rs new file mode 100644 index 000000000..bea570223 --- /dev/null +++ b/src/datadogV2/model/model_statsig_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum StatsigAPIKeyType { + STATSIGAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for StatsigAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::STATSIGAPIKEY => String::from("StatsigAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for StatsigAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for StatsigAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "StatsigAPIKey" => Self::STATSIGAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_statsig_api_key_update.rs b/src/datadogV2/model/model_statsig_api_key_update.rs new file mode 100644 index 000000000..e31f04369 --- /dev/null +++ b/src/datadogV2/model/model_statsig_api_key_update.rs @@ -0,0 +1,119 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `StatsigAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct StatsigAPIKeyUpdate { + /// The `StatsigAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The definition of the `StatsigAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::StatsigAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl StatsigAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::StatsigAPIKeyType) -> StatsigAPIKeyUpdate { + StatsigAPIKeyUpdate { + api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for StatsigAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct StatsigAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for StatsigAPIKeyUpdateVisitor { + type Value = StatsigAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::StatsigAPIKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = StatsigAPIKeyUpdate { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(StatsigAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_statsig_credentials.rs b/src/datadogV2/model/model_statsig_credentials.rs new file mode 100644 index 000000000..7518f12bd --- /dev/null +++ b/src/datadogV2/model/model_statsig_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `StatsigCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum StatsigCredentials { + StatsigAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for StatsigCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(StatsigCredentials::StatsigAPIKey(_v)); + } + } + + return Ok(StatsigCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_statsig_credentials_update.rs b/src/datadogV2/model/model_statsig_credentials_update.rs new file mode 100644 index 000000000..2ecc6aea6 --- /dev/null +++ b/src/datadogV2/model/model_statsig_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `StatsigCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum StatsigCredentialsUpdate { + StatsigAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for StatsigCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(StatsigCredentialsUpdate::StatsigAPIKeyUpdate(_v)); + } + } + + return Ok(StatsigCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_statsig_integration.rs b/src/datadogV2/model/model_statsig_integration.rs new file mode 100644 index 000000000..8db88fb16 --- /dev/null +++ b/src/datadogV2/model/model_statsig_integration.rs @@ -0,0 +1,125 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `StatsigIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct StatsigIntegration { + /// The definition of the `StatsigCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::StatsigCredentials, + /// The definition of the `StatsigIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::StatsigIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl StatsigIntegration { + pub fn new( + credentials: crate::datadogV2::model::StatsigCredentials, + type_: crate::datadogV2::model::StatsigIntegrationType, + ) -> StatsigIntegration { + StatsigIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for StatsigIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct StatsigIntegrationVisitor; + impl<'a> Visitor<'a> for StatsigIntegrationVisitor { + type Value = StatsigIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::StatsigCredentials::UnparsedObject( + _credentials, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::StatsigIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = StatsigIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(StatsigIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_statsig_integration_type.rs b/src/datadogV2/model/model_statsig_integration_type.rs new file mode 100644 index 000000000..fa49aa510 --- /dev/null +++ b/src/datadogV2/model/model_statsig_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum StatsigIntegrationType { + STATSIG, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for StatsigIntegrationType { + fn to_string(&self) -> String { + match self { + Self::STATSIG => String::from("Statsig"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for StatsigIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for StatsigIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Statsig" => Self::STATSIG, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_statsig_integration_update.rs b/src/datadogV2/model/model_statsig_integration_update.rs new file mode 100644 index 000000000..22bc9bdf9 --- /dev/null +++ b/src/datadogV2/model/model_statsig_integration_update.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `StatsigIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct StatsigIntegrationUpdate { + /// The definition of the `StatsigCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `StatsigIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::StatsigIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl StatsigIntegrationUpdate { + pub fn new(type_: crate::datadogV2::model::StatsigIntegrationType) -> StatsigIntegrationUpdate { + StatsigIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials(mut self, value: crate::datadogV2::model::StatsigCredentialsUpdate) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for StatsigIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct StatsigIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for StatsigIntegrationUpdateVisitor { + type Value = StatsigIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::StatsigCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::StatsigIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = StatsigIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(StatsigIntegrationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_virus_total_api_key.rs b/src/datadogV2/model/model_virus_total_api_key.rs new file mode 100644 index 000000000..ffa8cda20 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_api_key.rs @@ -0,0 +1,113 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `VirusTotalAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct VirusTotalAPIKey { + /// The `VirusTotalAPIKey` `api_key`. + #[serde(rename = "api_key")] + pub api_key: String, + /// The definition of the `VirusTotalAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::VirusTotalAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl VirusTotalAPIKey { + pub fn new( + api_key: String, + type_: crate::datadogV2::model::VirusTotalAPIKeyType, + ) -> VirusTotalAPIKey { + VirusTotalAPIKey { + api_key, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for VirusTotalAPIKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct VirusTotalAPIKeyVisitor; + impl<'a> Visitor<'a> for VirusTotalAPIKeyVisitor { + type Value = VirusTotalAPIKey; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::VirusTotalAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = VirusTotalAPIKey { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(VirusTotalAPIKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_virus_total_api_key_type.rs b/src/datadogV2/model/model_virus_total_api_key_type.rs new file mode 100644 index 000000000..2c5201ea2 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_api_key_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum VirusTotalAPIKeyType { + VIRUSTOTALAPIKEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for VirusTotalAPIKeyType { + fn to_string(&self) -> String { + match self { + Self::VIRUSTOTALAPIKEY => String::from("VirusTotalAPIKey"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for VirusTotalAPIKeyType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for VirusTotalAPIKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "VirusTotalAPIKey" => Self::VIRUSTOTALAPIKEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_virus_total_api_key_update.rs b/src/datadogV2/model/model_virus_total_api_key_update.rs new file mode 100644 index 000000000..4a3027116 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_api_key_update.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `VirusTotalAPIKey` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct VirusTotalAPIKeyUpdate { + /// The `VirusTotalAPIKeyUpdate` `api_key`. + #[serde(rename = "api_key")] + pub api_key: Option, + /// The definition of the `VirusTotalAPIKey` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::VirusTotalAPIKeyType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl VirusTotalAPIKeyUpdate { + pub fn new(type_: crate::datadogV2::model::VirusTotalAPIKeyType) -> VirusTotalAPIKeyUpdate { + VirusTotalAPIKeyUpdate { + api_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn api_key(mut self, value: String) -> Self { + self.api_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for VirusTotalAPIKeyUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct VirusTotalAPIKeyUpdateVisitor; + impl<'a> Visitor<'a> for VirusTotalAPIKeyUpdateVisitor { + type Value = VirusTotalAPIKeyUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut api_key: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "api_key" => { + if v.is_null() { + continue; + } + api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::VirusTotalAPIKeyType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = VirusTotalAPIKeyUpdate { + api_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(VirusTotalAPIKeyUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_virus_total_credentials.rs b/src/datadogV2/model/model_virus_total_credentials.rs new file mode 100644 index 000000000..e2415fd06 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_credentials.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `VirusTotalCredentials` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum VirusTotalCredentials { + VirusTotalAPIKey(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for VirusTotalCredentials { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(VirusTotalCredentials::VirusTotalAPIKey(_v)); + } + } + + return Ok(VirusTotalCredentials::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_virus_total_credentials_update.rs b/src/datadogV2/model/model_virus_total_credentials_update.rs new file mode 100644 index 000000000..b4562c894 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_credentials_update.rs @@ -0,0 +1,33 @@ +// 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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of the `VirusTotalCredentialsUpdate` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum VirusTotalCredentialsUpdate { + VirusTotalAPIKeyUpdate(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for VirusTotalCredentialsUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(VirusTotalCredentialsUpdate::VirusTotalAPIKeyUpdate(_v)); + } + } + + return Ok(VirusTotalCredentialsUpdate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_virus_total_integration.rs b/src/datadogV2/model/model_virus_total_integration.rs new file mode 100644 index 000000000..ce5f19542 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_integration.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `VirusTotalIntegration` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct VirusTotalIntegration { + /// The definition of the `VirusTotalCredentials` object. + #[serde(rename = "credentials")] + pub credentials: crate::datadogV2::model::VirusTotalCredentials, + /// The definition of the `VirusTotalIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::VirusTotalIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl VirusTotalIntegration { + pub fn new( + credentials: crate::datadogV2::model::VirusTotalCredentials, + type_: crate::datadogV2::model::VirusTotalIntegrationType, + ) -> VirusTotalIntegration { + VirusTotalIntegration { + credentials, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for VirusTotalIntegration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct VirusTotalIntegrationVisitor; + impl<'a> Visitor<'a> for VirusTotalIntegrationVisitor { + type Value = VirusTotalIntegration; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::VirusTotalCredentials::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::VirusTotalIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let credentials = + credentials.ok_or_else(|| M::Error::missing_field("credentials"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = VirusTotalIntegration { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(VirusTotalIntegrationVisitor) + } +} diff --git a/src/datadogV2/model/model_virus_total_integration_type.rs b/src/datadogV2/model/model_virus_total_integration_type.rs new file mode 100644 index 000000000..a2db260c3 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_integration_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum VirusTotalIntegrationType { + VIRUSTOTAL, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for VirusTotalIntegrationType { + fn to_string(&self) -> String { + match self { + Self::VIRUSTOTAL => String::from("VirusTotal"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for VirusTotalIntegrationType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for VirusTotalIntegrationType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "VirusTotal" => Self::VIRUSTOTAL, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_virus_total_integration_update.rs b/src/datadogV2/model/model_virus_total_integration_update.rs new file mode 100644 index 000000000..1f7c76c32 --- /dev/null +++ b/src/datadogV2/model/model_virus_total_integration_update.rs @@ -0,0 +1,132 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of the `VirusTotalIntegrationUpdate` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct VirusTotalIntegrationUpdate { + /// The definition of the `VirusTotalCredentialsUpdate` object. + #[serde(rename = "credentials")] + pub credentials: Option, + /// The definition of the `VirusTotalIntegrationType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::VirusTotalIntegrationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl VirusTotalIntegrationUpdate { + pub fn new( + type_: crate::datadogV2::model::VirusTotalIntegrationType, + ) -> VirusTotalIntegrationUpdate { + VirusTotalIntegrationUpdate { + credentials: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn credentials( + mut self, + value: crate::datadogV2::model::VirusTotalCredentialsUpdate, + ) -> Self { + self.credentials = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for VirusTotalIntegrationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct VirusTotalIntegrationUpdateVisitor; + impl<'a> Visitor<'a> for VirusTotalIntegrationUpdateVisitor { + type Value = VirusTotalIntegrationUpdate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut credentials: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "credentials" => { + if v.is_null() { + continue; + } + credentials = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _credentials) = credentials { + match _credentials { + crate::datadogV2::model::VirusTotalCredentialsUpdate::UnparsedObject(_credentials) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::VirusTotalIntegrationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = VirusTotalIntegrationUpdate { + credentials, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(VirusTotalIntegrationUpdateVisitor) + } +}