diff --git a/.apigentools-info b/.apigentools-info index 3cd471e0ea87..d2c44339f989 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-28 08:41:48.050958", - "spec_repo_commit": "21917b12" + "regenerated": "2023-03-29 13:52:20.564000", + "spec_repo_commit": "1f3268e7" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-28 08:41:48.068067", - "spec_repo_commit": "21917b12" + "regenerated": "2023-03-29 13:52:20.576473", + "spec_repo_commit": "1f3268e7" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 68d43313a338..8a8b63be81eb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12101,6 +12101,7 @@ components: oneOf: - $ref: '#/components/schemas/ServiceDefinitionV1' - $ref: '#/components/schemas/ServiceDefinitionV2' + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1' type: object ServiceDefinitionV1: deprecated: true @@ -12331,6 +12332,209 @@ components: - name - url type: object + ServiceDefinitionV2Dot1: + description: Service definition v2.1 for providing service metadata and integrations. + properties: + application: + description: Identifier for a group of related services serving a product + feature, which the service is a part of. + example: my-app + type: string + contacts: + description: A list of contacts related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Contact' + type: array + dd-service: + description: Unique identifier of the service. Must be unique across all + services and is used to match with a service in Datadog. + example: my-service + type: string + description: + description: A short description of the service. + example: My service description + type: string + extensions: + additionalProperties: {} + description: Extensions to v2.1 schema. + example: + myorg/extension: extensionValue + type: object + integrations: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Integrations' + lifecycle: + description: The current life cycle phase of the service. + example: sandbox + type: string + links: + description: A list of links related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Link' + type: array + schema-version: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Version' + tags: + description: A set of custom tags. + example: + - my:tag + - service:tag + items: + type: string + type: array + team: + description: Team that owns the service. It is used to locate a team defined + in Datadog Teams if it exists. + example: my-team + type: string + tier: + description: Importance of the service. + example: High + type: string + required: + - schema-version + - dd-service + type: object + ServiceDefinitionV2Dot1Contact: + description: Service owner's contacts information. + oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1Email' + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1Slack' + ServiceDefinitionV2Dot1Email: + description: Service owner's email. + properties: + contact: + description: Contact value. + example: contact@datadoghq.com + format: email + type: string + name: + description: Contact email. + example: Team Email + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1EmailType' + required: + - type + - contact + type: object + ServiceDefinitionV2Dot1EmailType: + description: Contact type. + enum: + - email + example: email + type: string + x-enum-varnames: + - EMAIL + ServiceDefinitionV2Dot1Integrations: + description: Third party integrations that Datadog supports. + properties: + opsgenie: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Opsgenie' + pagerduty: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1Pagerduty' + type: object + ServiceDefinitionV2Dot1Link: + description: Service's external links. + properties: + name: + description: Link name. + example: Runbook + type: string + provider: + description: Link provider. + example: Github + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1LinkType' + url: + description: Link URL. + example: https://my-runbook + type: string + required: + - name + - type + - url + type: object + ServiceDefinitionV2Dot1LinkType: + description: Link type. + enum: + - doc + - repo + - runbook + - dashboard + - other + example: runbook + type: string + x-enum-varnames: + - DOC + - REPO + - RUNBOOK + - DASHBOARD + - OTHER + ServiceDefinitionV2Dot1Opsgenie: + description: Opsgenie integration for the service. + properties: + region: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1OpsgenieRegion' + service-url: + description: Opsgenie service url. + example: https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000 + type: string + required: + - service-url + type: object + ServiceDefinitionV2Dot1OpsgenieRegion: + description: Opsgenie instance region. + enum: + - US + - EU + example: US + type: string + x-enum-varnames: + - US + - EU + ServiceDefinitionV2Dot1Pagerduty: + description: PagerDuty integration for the service. + properties: + service-url: + description: PagerDuty service url. + example: https://my-org.pagerduty.com/service-directory/PMyService + type: string + type: object + ServiceDefinitionV2Dot1Slack: + description: Service owner's Slack channel. + properties: + contact: + description: Slack Channel. + example: https://yourcompany.slack.com/archives/channel123 + type: string + name: + description: Contact Slack. + example: Team Slack + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2Dot1SlackType' + required: + - type + - contact + type: object + ServiceDefinitionV2Dot1SlackType: + description: Contact type. + enum: + - slack + example: slack + type: string + x-enum-varnames: + - SLACK + ServiceDefinitionV2Dot1Version: + default: v2.1 + description: Schema version being used. + enum: + - v2.1 + example: v2.1 + type: string + x-enum-varnames: + - V2_1 ServiceDefinitionV2Email: description: Service owner's email. properties: @@ -12489,6 +12693,7 @@ components: ServiceDefinitionsCreateRequest: description: Create service definitions request. oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2Dot1' - $ref: '#/components/schemas/ServiceDefinitionV2' - $ref: '#/components/schemas/ServiceDefinitionRaw' ServiceDefinitionsListResponse: diff --git a/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.frozen b/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.frozen index be705da1fc75..7135c3fee483 100644 --- a/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.frozen +++ b/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.frozen @@ -1 +1 @@ -2022-11-10T21:14:44.544Z \ No newline at end of file +2023-03-24T18:06:23.874Z \ No newline at end of file diff --git a/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.yml b/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.yml index 7e694254a478..1f30d3796a3c 100644 --- a/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.yml +++ b/cassettes/features/v2/service_definition/Create-or-update-service-definition-returns-CREATED-response.yml @@ -1,9 +1,9 @@ http_interactions: -- recorded_at: Thu, 10 Nov 2022 21:14:44 GMT +- recorded_at: Fri, 24 Mar 2023 18:06:23 GMT request: body: encoding: UTF-8 - string: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-Test-Create_or_update_service_definition_returns_CREATED_response-1668114884","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google + string: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-testcreateorupdateservicedefinitionreturnscreatedresponse1679681183","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mydoc"}],"extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"schema-version":"v2","tags":["my:tag","service:tag"],"team":"my-team"}' headers: @@ -16,7 +16,7 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2022-11-10T21:14:45.52228008Z","github-html-url":"","ingestion-source":"api","warnings":[],"ingested-schema-version":"v2"},"schema":{"schema-version":"v2","dd-service":"service-test-create_or_update_service_definition_returns_created_response-1668114884","dd-team":"my-team","team":"my-team","contacts":[{"name":"Team + string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-03-24T18:06:24.041193351Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2"},"schema":{"schema-version":"v2","dd-service":"service-testcreateorupdateservicedefinitionreturnscreatedresponse1679681183","dd-team":"my-team","team":"my-team","contacts":[{"name":"Team Email","type":"email","contact":"contact@datadoghq.com"}],"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mydoc"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService","opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"}}}}]} @@ -28,14 +28,14 @@ http_interactions: status: code: 200 message: OK -- recorded_at: Thu, 10 Nov 2022 21:14:44 GMT +- recorded_at: Fri, 24 Mar 2023 18:06:23 GMT request: body: null headers: Accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/services/definitions/service-test-create_or_update_service_definition_returns_created_response-1668114884 + uri: https://api.datadoghq.com/api/v2/services/definitions/service-testcreateorupdateservicedefinitionreturnscreatedresponse1679681183 response: body: encoding: UTF-8 diff --git a/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-1-returns-CREATED-response.frozen b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-1-returns-CREATED-response.frozen new file mode 100644 index 000000000000..cf656770f53f --- /dev/null +++ b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-1-returns-CREATED-response.frozen @@ -0,0 +1 @@ +2023-03-28T20:28:44.080Z \ No newline at end of file diff --git a/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-1-returns-CREATED-response.yml b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-1-returns-CREATED-response.yml new file mode 100644 index 000000000000..f66a09b95501 --- /dev/null +++ b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-1-returns-CREATED-response.yml @@ -0,0 +1,51 @@ +http_interactions: +- recorded_at: Tue, 28 Mar 2023 20:28:44 GMT + request: + body: + encoding: UTF-8 + string: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-Test-Create_or_update_service_definition_using_schema_v2_1_returns_CREATED_response-1680035324","extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"}},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source + Code","provider":"GitHub","type":"repo","url":"https://github.com/DataDog/schema"},{"name":"Architecture","provider":"Gigoogle + drivetHub","type":"doc","url":"https://my-runbook"}],"schema-version":"v2.1","tags":["my:tag","service:tag"],"team":"my-team"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/services/definitions + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-03-28T20:28:44.264527027Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2.1"},"schema":{"schema-version":"v2.1","dd-service":"service-test-create_or_update_service_definition_using_schema_v2_1_returns_created_response-1680035324","team":"my-team","contacts":[{"name":"Team + Email","type":"email","contact":"contact@datadoghq.com"}],"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source + Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"},{"name":"Architecture","type":"doc","provider":"Gigoogle + drivetHub","url":"https://my-runbook"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"},"opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"}}}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 28 Mar 2023 20:28:44 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/services/definitions/service-test-create_or_update_service_definition_using_schema_v2_1_returns_created_response-1680035324 + response: + body: + encoding: UTF-8 + string: '{"errors":["Not Found"],"error_details":[{}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-returns-CREATED-response.frozen b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-returns-CREATED-response.frozen new file mode 100644 index 000000000000..99e422211492 --- /dev/null +++ b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-returns-CREATED-response.frozen @@ -0,0 +1 @@ +2023-03-24T19:21:51.782Z \ No newline at end of file diff --git a/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-returns-CREATED-response.yml b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-returns-CREATED-response.yml new file mode 100644 index 000000000000..263586d66060 --- /dev/null +++ b/cassettes/features/v2/service_definition/Create-or-update-service-definition-using-schema-v2-returns-CREATED-response.yml @@ -0,0 +1,51 @@ +http_interactions: +- recorded_at: Fri, 24 Mar 2023 19:21:51 GMT + request: + body: + encoding: UTF-8 + string: '{"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-testcreateorupdateservicedefinitionusingschemav2returnscreatedresponse1679685711","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google + drive","url":"https://gdrive/mydoc"}],"extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source + Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"schema-version":"v2","tags":["my:tag","service:tag"],"team":"my-team"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/services/definitions + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-03-24T19:21:52.44477064Z","github-html-url":"","ingestion-source":"api","origin":"unknown","origin-detail":"","warnings":[],"ingested-schema-version":"v2"},"schema":{"schema-version":"v2","dd-service":"service-testcreateorupdateservicedefinitionusingschemav2returnscreatedresponse1679685711","dd-team":"my-team","team":"my-team","contacts":[{"name":"Team + Email","type":"email","contact":"contact@datadoghq.com"}],"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"}],"repos":[{"name":"Source + Code","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"docs":[{"name":"Architecture","provider":"google + drive","url":"https://gdrive/mydoc"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService","opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"}}}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Fri, 24 Mar 2023 19:21:51 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/services/definitions/service-testcreateorupdateservicedefinitionusingschemav2returnscreatedresponse1679685711 + response: + body: + encoding: UTF-8 + string: '{"errors":["Not Found"],"error_details":[{}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb index 430ff8e60c0d..c3e9a0737b84 100644 --- a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.rb @@ -3,52 +3,44 @@ require "datadog_api_client" api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new -body = DatadogAPIClient::V2::ServiceDefinitionV2.new({ +body = DatadogAPIClient::V2::ServiceDefinitionV2Dot1.new({ + application: "my-app", contacts: [ - DatadogAPIClient::V2::ServiceDefinitionV2Email.new({ + DatadogAPIClient::V2::ServiceDefinitionV2Dot1Email.new({ contact: "contact@datadoghq.com", name: "Team Email", - type: DatadogAPIClient::V2::ServiceDefinitionV2EmailType::EMAIL, - }), - ], - dd_service: "service-Example-Create_or_update_service_definition_returns_CREATED_response", - dd_team: "my-team", - docs: [ - DatadogAPIClient::V2::ServiceDefinitionV2Doc.new({ - name: "Architecture", - provider: "google drive", - url: "https://gdrive/mydoc", + type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1EmailType::EMAIL, }), ], + dd_service: "my-service", + description: "My service description", extensions: { - "myorgextension": "extensionvalue", + "myorg/extension": "extensionValue", }, - integrations: DatadogAPIClient::V2::ServiceDefinitionV2Integrations.new({ - opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Opsgenie.new({ - region: DatadogAPIClient::V2::ServiceDefinitionV2OpsgenieRegion::US, + integrations: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Integrations.new({ + opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Opsgenie.new({ + region: DatadogAPIClient::V2::ServiceDefinitionV2Dot1OpsgenieRegion::US, service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", }), - pagerduty: "https://my-org.pagerduty.com/service-directory/PMyService", + pagerduty: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Pagerduty.new({ + service_url: "https://my-org.pagerduty.com/service-directory/PMyService", + }), }), + lifecycle: "sandbox", links: [ - DatadogAPIClient::V2::ServiceDefinitionV2Link.new({ + DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({ name: "Runbook", - type: DatadogAPIClient::V2::ServiceDefinitionV2LinkType::RUNBOOK, + provider: "Github", + type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::RUNBOOK, url: "https://my-runbook", }), ], - repos: [ - DatadogAPIClient::V2::ServiceDefinitionV2Repo.new({ - name: "Source Code", - provider: "GitHub", - url: "https://github.com/DataDog/schema", - }), - ], - schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Version::V2, + schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Version::V2_1, tags: [ "my:tag", "service:tag", ], team: "my-team", + tier: "High", }) p api_instance.create_or_update_service_definitions(body) diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.rb b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.rb new file mode 100644 index 000000000000..63d6a8c04dcc --- /dev/null +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_1808735248.rb @@ -0,0 +1,54 @@ +# Create or update service definition using schema v2 returns "CREATED" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new + +body = DatadogAPIClient::V2::ServiceDefinitionV2.new({ + contacts: [ + DatadogAPIClient::V2::ServiceDefinitionV2Email.new({ + contact: "contact@datadoghq.com", + name: "Team Email", + type: DatadogAPIClient::V2::ServiceDefinitionV2EmailType::EMAIL, + }), + ], + dd_service: "service-examplecreateorupdateservicedefinitionusingschemav2returnscreatedresponse", + dd_team: "my-team", + docs: [ + DatadogAPIClient::V2::ServiceDefinitionV2Doc.new({ + name: "Architecture", + provider: "google drive", + url: "https://gdrive/mydoc", + }), + ], + extensions: { + "myorgextension": "extensionvalue", + }, + integrations: DatadogAPIClient::V2::ServiceDefinitionV2Integrations.new({ + opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Opsgenie.new({ + region: DatadogAPIClient::V2::ServiceDefinitionV2OpsgenieRegion::US, + service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", + }), + pagerduty: "https://my-org.pagerduty.com/service-directory/PMyService", + }), + links: [ + DatadogAPIClient::V2::ServiceDefinitionV2Link.new({ + name: "Runbook", + type: DatadogAPIClient::V2::ServiceDefinitionV2LinkType::RUNBOOK, + url: "https://my-runbook", + }), + ], + repos: [ + DatadogAPIClient::V2::ServiceDefinitionV2Repo.new({ + name: "Source Code", + provider: "GitHub", + url: "https://github.com/DataDog/schema", + }), + ], + schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Version::V2, + tags: [ + "my:tag", + "service:tag", + ], + team: "my-team", +}) +p api_instance.create_or_update_service_definitions(body) diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb new file mode 100644 index 000000000000..0cf807442a16 --- /dev/null +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions_2619874414.rb @@ -0,0 +1,53 @@ +# Create or update service definition using schema v2-1 returns "CREATED" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new + +body = DatadogAPIClient::V2::ServiceDefinitionV2Dot1.new({ + contacts: [ + DatadogAPIClient::V2::ServiceDefinitionV2Dot1Email.new({ + contact: "contact@datadoghq.com", + name: "Team Email", + type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1EmailType::EMAIL, + }), + ], + dd_service: "service-Example-Create_or_update_service_definition_using_schema_v2_1_returns_CREATED_response", + extensions: { + "myorgextension": "extensionvalue", + }, + integrations: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Integrations.new({ + opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Opsgenie.new({ + region: DatadogAPIClient::V2::ServiceDefinitionV2Dot1OpsgenieRegion::US, + service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000", + }), + pagerduty: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Pagerduty.new({ + service_url: "https://my-org.pagerduty.com/service-directory/PMyService", + }), + }), + links: [ + DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({ + name: "Runbook", + type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::RUNBOOK, + url: "https://my-runbook", + }), + DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({ + name: "Source Code", + type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::REPO, + provider: "GitHub", + url: "https://github.com/DataDog/schema", + }), + DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link.new({ + name: "Architecture", + type: DatadogAPIClient::V2::ServiceDefinitionV2Dot1LinkType::DOC, + provider: "Gigoogle drivetHub", + url: "https://my-runbook", + }), + ], + schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Dot1Version::V2_1, + tags: [ + "my:tag", + "service:tag", + ], + team: "my-team", +}) +p api_instance.create_or_update_service_definitions(body) diff --git a/features/v2/given.json b/features/v2/given.json index 4d1108166093..868c8c12e3d1 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -448,7 +448,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"dd-service\": \"service-{{ unique}}\",\n \"dd-team\": \"my-team\",\n \"docs\": [{\"name\": \"Architecture\",\n \"provider\": \"google drive\",\n \"url\": \"https://gdrive/mygivedoc\"}],\n \"extensions\": {\"frogextension\": \"extensionfrogvalue\"},\n \"integrations\": {\"opsgenie\": {\"region\": \"US\",\n \"service-url\": \"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\"},\n \"pagerduty\": \"https://my-org.pagerduty.com/service-directory/PMyService\"},\n \"links\": [{\"name\": \"Runbook\", \"type\": \"runbook\", \"url\": \"https://my-runbook\"}],\n \"repos\": [{\"name\": \"Source Code\",\n \"provider\": \"GitHub\",\n \"url\": \"https://github.com/DataDog/given\"}],\n \"schema-version\": \"v2\",\n \"tags\": [\"this:tag\", \"service:tag\"],\n \"team\": \"super-team\"\n}" + "value": "{\n \"dd-service\": \"service-{{ unique_lower_alnum }}\",\n \"dd-team\": \"my-team\",\n \"docs\": [{\"name\": \"Architecture\",\n \"provider\": \"google drive\",\n \"url\": \"https://gdrive/mygivedoc\"}],\n \"extensions\": {\"frogextension\": \"extensionfrogvalue\"},\n \"integrations\": {\"opsgenie\": {\"region\": \"US\",\n \"service-url\": \"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\"},\n \"pagerduty\": \"https://my-org.pagerduty.com/service-directory/PMyService\"},\n \"links\": [{\"name\": \"Runbook\", \"type\": \"runbook\", \"url\": \"https://my-runbook\"}],\n \"repos\": [{\"name\": \"Source Code\",\n \"provider\": \"GitHub\",\n \"url\": \"https://github.com/DataDog/given\"}],\n \"schema-version\": \"v2\",\n \"tags\": [\"this:tag\", \"service:tag\"],\n \"team\": \"super-team\"\n}" } ], "step": "there is a valid \"service_definition\" in the system", diff --git a/features/v2/service_definition.feature b/features/v2/service_definition.feature index be57dce43bfb..e2571848daf3 100644 --- a/features/v2/service_definition.feature +++ b/features/v2/service_definition.feature @@ -7,37 +7,53 @@ Feature: Service Definition And a valid "appKeyAuth" key in the system And an instance of "ServiceDefinition" API - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "Bad Request" response Given new "CreateOrUpdateServiceDefinitions" request - And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + And body with value {"application": "my-app", "contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.1", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "CREATED" response Given new "CreateOrUpdateServiceDefinitions" request - And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "service-{{ unique }}", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorgextension": "extensionvalue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + And body with value {"application": "my-app", "contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.1", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 200 CREATED - And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2" - And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower }}" - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Create or update service definition returns "Conflict" response Given new "CreateOrUpdateServiceDefinitions" request - And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + And body with value {"application": "my-app", "contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.1", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High"} When the request is sent Then the response status is 409 Conflict - @generated @skip @team:DataDog/apm-insights + @team:DataDog/service-catalog + Scenario: Create or update service definition using schema v2 returns "CREATED" response + Given new "CreateOrUpdateServiceDefinitions" request + And body with value {"contacts": [{"contact": "contact@datadoghq.com", "name": "Team Email", "type": "email"}], "dd-service": "service-{{ unique_lower_alnum }}", "dd-team": "my-team", "docs": [{"name": "Architecture", "provider": "google drive", "url": "https://gdrive/mydoc"}], "extensions": {"myorgextension": "extensionvalue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"}, "links": [{"name": "Runbook", "type": "runbook", "url": "https://my-runbook"}], "repos": [{"name": "Source Code", "provider": "GitHub", "url": "https://github.com/DataDog/schema"}], "schema-version": "v2", "tags": ["my:tag", "service:tag"], "team": "my-team"} + When the request is sent + Then the response status is 200 CREATED + And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2" + And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower_alnum }}" + + @team:DataDog/service-catalog + Scenario: Create or update service definition using schema v2-1 returns "CREATED" response + Given new "CreateOrUpdateServiceDefinitions" request + And body with value {"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-{{ unique }}","extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"},"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"}},"links":[{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"},{"name":"Architecture","type":"doc","provider":"Gigoogle drivetHub","url":"https://my-runbook"}],"schema-version":"v2.1","tags":["my:tag","service:tag"],"team":"my-team"} + When the request is sent + Then the response status is 200 CREATED + And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2.1" + And the response "data[0].attributes.schema.dd-service" is equal to "service-{{ unique_lower }}" + + @generated @skip @team:DataDog/service-catalog Scenario: Delete a single service definition returns "Bad Request" response Given new "DeleteServiceDefinition" request And request contains "service_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Delete a single service definition returns "Not Found" response Given new "DeleteServiceDefinition" request And request contains "service_name" parameter with value "not-a-service" @@ -45,28 +61,28 @@ Feature: Service Definition Then the response status is 404 Not Found And the response "errors[0]" is equal to "Not Found" - @replay-only @team:DataDog/apm-insights + @replay-only @team:DataDog/service-catalog Scenario: Delete a single service definition returns "OK" response Given new "DeleteServiceDefinition" request And request contains "service_name" parameter with value "service-definition-test" When the request is sent Then the response status is 204 OK - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Get a single service definition returns "Bad Request" response Given new "GetServiceDefinition" request And request contains "service_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/apm-insights + @generated @skip @team:DataDog/service-catalog Scenario: Get a single service definition returns "Conflict" response Given new "GetServiceDefinition" request And request contains "service_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 409 Conflict - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Get a single service definition returns "Not Found" response Given new "GetServiceDefinition" request And request contains "service_name" parameter with value "not-a-service" @@ -74,7 +90,7 @@ Feature: Service Definition Then the response status is 404 Not Found And the response "errors[0]" is equal to "Not Found" - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Get a single service definition returns "OK" response Given new "GetServiceDefinition" request And request contains "service_name" parameter with value "service-definition-test" @@ -83,7 +99,7 @@ Feature: Service Definition And the response "data.attributes.meta.ingested-schema-version" is equal to "v2" And the response "data.attributes.schema.dd-service" is equal to "service-definition-test" - @team:DataDog/apm-insights + @team:DataDog/service-catalog Scenario: Get all service definitions returns "OK" response Given new "ListServiceDefinitions" request When the request is sent diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 78bfcf46bc2b..b01ed00fd14f 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1574,6 +1574,19 @@ def overrides "v2.service_definition_v2" => "ServiceDefinitionV2", "v2.service_definition_v2_contact" => "ServiceDefinitionV2Contact", "v2.service_definition_v2_doc" => "ServiceDefinitionV2Doc", + "v2.service_definition_v2_dot1" => "ServiceDefinitionV2Dot1", + "v2.service_definition_v2_dot1_contact" => "ServiceDefinitionV2Dot1Contact", + "v2.service_definition_v2_dot1_email" => "ServiceDefinitionV2Dot1Email", + "v2.service_definition_v2_dot1_email_type" => "ServiceDefinitionV2Dot1EmailType", + "v2.service_definition_v2_dot1_integrations" => "ServiceDefinitionV2Dot1Integrations", + "v2.service_definition_v2_dot1_link" => "ServiceDefinitionV2Dot1Link", + "v2.service_definition_v2_dot1_link_type" => "ServiceDefinitionV2Dot1LinkType", + "v2.service_definition_v2_dot1_opsgenie" => "ServiceDefinitionV2Dot1Opsgenie", + "v2.service_definition_v2_dot1_opsgenie_region" => "ServiceDefinitionV2Dot1OpsgenieRegion", + "v2.service_definition_v2_dot1_pagerduty" => "ServiceDefinitionV2Dot1Pagerduty", + "v2.service_definition_v2_dot1_slack" => "ServiceDefinitionV2Dot1Slack", + "v2.service_definition_v2_dot1_slack_type" => "ServiceDefinitionV2Dot1SlackType", + "v2.service_definition_v2_dot1_version" => "ServiceDefinitionV2Dot1Version", "v2.service_definition_v2_email" => "ServiceDefinitionV2Email", "v2.service_definition_v2_email_type" => "ServiceDefinitionV2EmailType", "v2.service_definition_v2_integrations" => "ServiceDefinitionV2Integrations", diff --git a/lib/datadog_api_client/v2/models/service_definition_schema.rb b/lib/datadog_api_client/v2/models/service_definition_schema.rb index e173cbadb182..966cf2672e33 100644 --- a/lib/datadog_api_client/v2/models/service_definition_schema.rb +++ b/lib/datadog_api_client/v2/models/service_definition_schema.rb @@ -27,7 +27,8 @@ class << self def openapi_one_of [ :'ServiceDefinitionV1', - :'ServiceDefinitionV2' + :'ServiceDefinitionV2', + :'ServiceDefinitionV2Dot1' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1.rb new file mode 100644 index 000000000000..12ea3ec2526b --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1.rb @@ -0,0 +1,229 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Service definition v2.1 for providing service metadata and integrations. + class ServiceDefinitionV2Dot1 + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Identifier for a group of related services serving a product feature, which the service is a part of. + attr_accessor :application + + # A list of contacts related to the services. + attr_accessor :contacts + + # Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog. + attr_reader :dd_service + + # A short description of the service. + attr_accessor :description + + # Extensions to v2.1 schema. + attr_accessor :extensions + + # Third party integrations that Datadog supports. + attr_accessor :integrations + + # The current life cycle phase of the service. + attr_accessor :lifecycle + + # A list of links related to the services. + attr_accessor :links + + # Schema version being used. + attr_reader :schema_version + + # A set of custom tags. + attr_accessor :tags + + # Team that owns the service. It is used to locate a team defined in Datadog Teams if it exists. + attr_accessor :team + + # Importance of the service. + attr_accessor :tier + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'application' => :'application', + :'contacts' => :'contacts', + :'dd_service' => :'dd-service', + :'description' => :'description', + :'extensions' => :'extensions', + :'integrations' => :'integrations', + :'lifecycle' => :'lifecycle', + :'links' => :'links', + :'schema_version' => :'schema-version', + :'tags' => :'tags', + :'team' => :'team', + :'tier' => :'tier' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'application' => :'String', + :'contacts' => :'Array', + :'dd_service' => :'String', + :'description' => :'String', + :'extensions' => :'Hash', + :'integrations' => :'ServiceDefinitionV2Dot1Integrations', + :'lifecycle' => :'String', + :'links' => :'Array', + :'schema_version' => :'ServiceDefinitionV2Dot1Version', + :'tags' => :'Array', + :'team' => :'String', + :'tier' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'application') + self.application = attributes[:'application'] + end + + if attributes.key?(:'contacts') + if (value = attributes[:'contacts']).is_a?(Array) + self.contacts = value + end + end + + if attributes.key?(:'dd_service') + self.dd_service = attributes[:'dd_service'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'extensions') + self.extensions = attributes[:'extensions'] + end + + if attributes.key?(:'integrations') + self.integrations = attributes[:'integrations'] + end + + if attributes.key?(:'lifecycle') + self.lifecycle = attributes[:'lifecycle'] + end + + if attributes.key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + + if attributes.key?(:'schema_version') + self.schema_version = attributes[:'schema_version'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'team') + self.team = attributes[:'team'] + end + + if attributes.key?(:'tier') + self.tier = attributes[:'tier'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @dd_service.nil? + return false if @schema_version.nil? + true + end + + # Custom attribute writer method with validation + # @param dd_service [Object] Object to be assigned + # @!visibility private + def dd_service=(dd_service) + if dd_service.nil? + fail ArgumentError, 'invalid value for "dd_service", dd_service cannot be nil.' + end + @dd_service = dd_service + end + + # Custom attribute writer method with validation + # @param schema_version [Object] Object to be assigned + # @!visibility private + def schema_version=(schema_version) + if schema_version.nil? + fail ArgumentError, 'invalid value for "schema_version", schema_version cannot be nil.' + end + @schema_version = schema_version + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + application == o.application && + contacts == o.contacts && + dd_service == o.dd_service && + description == o.description && + extensions == o.extensions && + integrations == o.integrations && + lifecycle == o.lifecycle && + links == o.links && + schema_version == o.schema_version && + tags == o.tags && + team == o.team && + tier == o.tier + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [application, contacts, dd_service, description, extensions, integrations, lifecycle, links, schema_version, tags, team, tier].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_contact.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_contact.rb new file mode 100644 index 000000000000..e4c89383ae77 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_contact.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Service owner's contacts information. + module ServiceDefinitionV2Dot1Contact + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'ServiceDefinitionV2Dot1Email', + :'ServiceDefinitionV2Dot1Slack' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_email.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_email.rb new file mode 100644 index 000000000000..9b640ca4db89 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_email.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Service owner's email. + class ServiceDefinitionV2Dot1Email + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Contact value. + attr_reader :contact + + # Contact email. + attr_accessor :name + + # Contact type. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'contact' => :'contact', + :'name' => :'name', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'contact' => :'String', + :'name' => :'String', + :'type' => :'ServiceDefinitionV2Dot1EmailType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Email` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Email`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'contact') + self.contact = attributes[:'contact'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @contact.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param contact [Object] Object to be assigned + # @!visibility private + def contact=(contact) + if contact.nil? + fail ArgumentError, 'invalid value for "contact", contact cannot be nil.' + end + @contact = contact + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + contact == o.contact && + name == o.name && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [contact, name, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_email_type.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_email_type.rb new file mode 100644 index 000000000000..f6247e139b44 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_email_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Contact type. + class ServiceDefinitionV2Dot1EmailType + include BaseEnumModel + + EMAIL = "email".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_integrations.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_integrations.rb new file mode 100644 index 000000000000..22dde44bcdc3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_integrations.rb @@ -0,0 +1,101 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Third party integrations that Datadog supports. + class ServiceDefinitionV2Dot1Integrations + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Opsgenie integration for the service. + attr_accessor :opsgenie + + # PagerDuty integration for the service. + attr_accessor :pagerduty + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'opsgenie' => :'opsgenie', + :'pagerduty' => :'pagerduty' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'opsgenie' => :'ServiceDefinitionV2Dot1Opsgenie', + :'pagerduty' => :'ServiceDefinitionV2Dot1Pagerduty' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Integrations` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Integrations`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'opsgenie') + self.opsgenie = attributes[:'opsgenie'] + end + + if attributes.key?(:'pagerduty') + self.pagerduty = attributes[:'pagerduty'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + opsgenie == o.opsgenie && + pagerduty == o.pagerduty + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [opsgenie, pagerduty].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_link.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_link.rb new file mode 100644 index 000000000000..d4fb8bdacc51 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_link.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Service's external links. + class ServiceDefinitionV2Dot1Link + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Link name. + attr_reader :name + + # Link provider. + attr_accessor :provider + + # Link type. + attr_reader :type + + # Link URL. + attr_reader :url + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'provider' => :'provider', + :'type' => :'type', + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'provider' => :'String', + :'type' => :'ServiceDefinitionV2Dot1LinkType', + :'url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Link`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'provider') + self.provider = attributes[:'provider'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @type.nil? + return false if @url.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param url [Object] Object to be assigned + # @!visibility private + def url=(url) + if url.nil? + fail ArgumentError, 'invalid value for "url", url cannot be nil.' + end + @url = url + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + provider == o.provider && + type == o.type && + url == o.url + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, provider, type, url].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_link_type.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_link_type.rb new file mode 100644 index 000000000000..729eb9aaf050 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_link_type.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Link type. + class ServiceDefinitionV2Dot1LinkType + include BaseEnumModel + + DOC = "doc".freeze + REPO = "repo".freeze + RUNBOOK = "runbook".freeze + DASHBOARD = "dashboard".freeze + OTHER = "other".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_opsgenie.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_opsgenie.rb new file mode 100644 index 000000000000..2ed3bcc3de0d --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_opsgenie.rb @@ -0,0 +1,112 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Opsgenie integration for the service. + class ServiceDefinitionV2Dot1Opsgenie + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Opsgenie instance region. + attr_accessor :region + + # Opsgenie service url. + attr_reader :service_url + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'region' => :'region', + :'service_url' => :'service-url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'region' => :'ServiceDefinitionV2Dot1OpsgenieRegion', + :'service_url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Opsgenie` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Opsgenie`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + + if attributes.key?(:'service_url') + self.service_url = attributes[:'service_url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @service_url.nil? + true + end + + # Custom attribute writer method with validation + # @param service_url [Object] Object to be assigned + # @!visibility private + def service_url=(service_url) + if service_url.nil? + fail ArgumentError, 'invalid value for "service_url", service_url cannot be nil.' + end + @service_url = service_url + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + region == o.region && + service_url == o.service_url + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [region, service_url].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_opsgenie_region.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_opsgenie_region.rb new file mode 100644 index 000000000000..0ff9c83abfcd --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_opsgenie_region.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Opsgenie instance region. + class ServiceDefinitionV2Dot1OpsgenieRegion + include BaseEnumModel + + US = "US".freeze + EU = "EU".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_pagerduty.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_pagerduty.rb new file mode 100644 index 000000000000..6bf73957eeb3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_pagerduty.rb @@ -0,0 +1,91 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # PagerDuty integration for the service. + class ServiceDefinitionV2Dot1Pagerduty + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # PagerDuty service url. + attr_accessor :service_url + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'service_url' => :'service-url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'service_url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Pagerduty` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Pagerduty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'service_url') + self.service_url = attributes[:'service_url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + service_url == o.service_url + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [service_url].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_slack.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_slack.rb new file mode 100644 index 000000000000..698abd038af2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_slack.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Service owner's Slack channel. + class ServiceDefinitionV2Dot1Slack + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Slack Channel. + attr_reader :contact + + # Contact Slack. + attr_accessor :name + + # Contact type. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'contact' => :'contact', + :'name' => :'name', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'contact' => :'String', + :'name' => :'String', + :'type' => :'ServiceDefinitionV2Dot1SlackType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Slack` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ServiceDefinitionV2Dot1Slack`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'contact') + self.contact = attributes[:'contact'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @contact.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param contact [Object] Object to be assigned + # @!visibility private + def contact=(contact) + if contact.nil? + fail ArgumentError, 'invalid value for "contact", contact cannot be nil.' + end + @contact = contact + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + contact == o.contact && + name == o.name && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [contact, name, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_slack_type.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_slack_type.rb new file mode 100644 index 000000000000..cfbe0f517e5b --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_slack_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Contact type. + class ServiceDefinitionV2Dot1SlackType + include BaseEnumModel + + SLACK = "slack".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/service_definition_v2_dot1_version.rb b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_version.rb new file mode 100644 index 000000000000..3b7d0f5d5a60 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_definition_v2_dot1_version.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Schema version being used. + class ServiceDefinitionV2Dot1Version + include BaseEnumModel + + V2_1 = "v2.1".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/service_definitions_create_request.rb b/lib/datadog_api_client/v2/models/service_definitions_create_request.rb index 56257ae1cf92..23557fdcd3da 100644 --- a/lib/datadog_api_client/v2/models/service_definitions_create_request.rb +++ b/lib/datadog_api_client/v2/models/service_definitions_create_request.rb @@ -26,6 +26,7 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ + :'ServiceDefinitionV2Dot1', :'ServiceDefinitionV2', :'String' ]