From 7866bb81d1e399e20c5e99e2536b126b2b9870fc Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:11:41 +0000 Subject: [PATCH] Add support for service definitions APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix example generation * Fix BDD extraction * Regenerate client from commit 9f80a9c5 of spec repo Co-authored-by: Thomas Hervé Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 567 ++++++++++++++++++ .generator/src/generator/formatter.py | 13 +- api/datadogV2/api_service_definition.go | 493 +++++++++++++++ ...odel_service_definition_create_response.go | 98 +++ .../model_service_definition_data.go | 140 +++++ ...odel_service_definition_data_attributes.go | 140 +++++ .../model_service_definition_get_response.go | 105 ++++ .../model_service_definition_meta.go | 203 +++++++ .../model_service_definition_schema.go | 155 +++++ api/datadogV2/model_service_definition_v1.go | 386 ++++++++++++ .../model_service_definition_v1_contact.go | 133 ++++ .../model_service_definition_v1_info.go | 208 +++++++ ...odel_service_definition_v1_integrations.go | 98 +++ .../model_service_definition_v1_org.go | 133 ++++ .../model_service_definition_v1_resource.go | 177 ++++++ ...del_service_definition_v1_resource_type.go | 123 ++++ .../model_service_definition_v1_version.go | 107 ++++ api/datadogV2/model_service_definition_v2.go | 468 +++++++++++++++ .../model_service_definition_v2_contact.go | 155 +++++ .../model_service_definition_v2_doc.go | 171 ++++++ .../model_service_definition_v2_email.go | 179 ++++++ .../model_service_definition_v2_email_type.go | 107 ++++ ...odel_service_definition_v2_integrations.go | 140 +++++ .../model_service_definition_v2_link.go | 177 ++++++ .../model_service_definition_v2_link_type.go | 123 ++++ .../model_service_definition_v2_opsgenie.go | 146 +++++ ...l_service_definition_v2_opsgenie_region.go | 109 ++++ .../model_service_definition_v2_repo.go | 171 ++++++ .../model_service_definition_v2_slack.go | 179 ++++++ .../model_service_definition_v2_slack_type.go | 107 ++++ .../model_service_definition_v2_version.go | 107 ++++ ...odel_service_definitions_create_request.go | 155 +++++ ...model_service_definitions_list_response.go | 98 +++ .../CreateOrUpdateServiceDefinitions.go | 79 +++ .../DeleteServiceDefinition.go | 25 + .../GetServiceDefinition.go | 29 + .../ListServiceDefinitions.go | 29 + tests/scenarios/api_mappings.go | 1 + ...definition_returns_CREATED_response.freeze | 1 + ...e_definition_returns_CREATED_response.yaml | 44 ++ ...finition_returns_Not_Found_response.freeze | 1 + ...definition_returns_Not_Found_response.yaml | 20 + ...vice_definition_returns_OK_response.freeze | 1 + ...ervice_definition_returns_OK_response.yaml | 56 ++ ...finition_returns_Not_Found_response.freeze | 1 + ...definition_returns_Not_Found_response.yaml | 20 + ...vice_definition_returns_OK_response.freeze | 1 + ...ervice_definition_returns_OK_response.yaml | 59 ++ ...ice_definitions_returns_OK_response.freeze | 1 + ...rvice_definitions_returns_OK_response.yaml | 372 ++++++++++++ tests/scenarios/features/v2/given.json | 12 + .../features/v2/service_definition.feature | 91 +++ tests/scenarios/features/v2/undo.json | 31 + tests/scenarios/step_definitions.go | 4 +- 55 files changed, 6748 insertions(+), 9 deletions(-) create mode 100644 api/datadogV2/api_service_definition.go create mode 100644 api/datadogV2/model_service_definition_create_response.go create mode 100644 api/datadogV2/model_service_definition_data.go create mode 100644 api/datadogV2/model_service_definition_data_attributes.go create mode 100644 api/datadogV2/model_service_definition_get_response.go create mode 100644 api/datadogV2/model_service_definition_meta.go create mode 100644 api/datadogV2/model_service_definition_schema.go create mode 100644 api/datadogV2/model_service_definition_v1.go create mode 100644 api/datadogV2/model_service_definition_v1_contact.go create mode 100644 api/datadogV2/model_service_definition_v1_info.go create mode 100644 api/datadogV2/model_service_definition_v1_integrations.go create mode 100644 api/datadogV2/model_service_definition_v1_org.go create mode 100644 api/datadogV2/model_service_definition_v1_resource.go create mode 100644 api/datadogV2/model_service_definition_v1_resource_type.go create mode 100644 api/datadogV2/model_service_definition_v1_version.go create mode 100644 api/datadogV2/model_service_definition_v2.go create mode 100644 api/datadogV2/model_service_definition_v2_contact.go create mode 100644 api/datadogV2/model_service_definition_v2_doc.go create mode 100644 api/datadogV2/model_service_definition_v2_email.go create mode 100644 api/datadogV2/model_service_definition_v2_email_type.go create mode 100644 api/datadogV2/model_service_definition_v2_integrations.go create mode 100644 api/datadogV2/model_service_definition_v2_link.go create mode 100644 api/datadogV2/model_service_definition_v2_link_type.go create mode 100644 api/datadogV2/model_service_definition_v2_opsgenie.go create mode 100644 api/datadogV2/model_service_definition_v2_opsgenie_region.go create mode 100644 api/datadogV2/model_service_definition_v2_repo.go create mode 100644 api/datadogV2/model_service_definition_v2_slack.go create mode 100644 api/datadogV2/model_service_definition_v2_slack_type.go create mode 100644 api/datadogV2/model_service_definition_v2_version.go create mode 100644 api/datadogV2/model_service_definitions_create_request.go create mode 100644 api/datadogV2/model_service_definitions_list_response.go create mode 100644 examples/v2/service-definition/CreateOrUpdateServiceDefinitions.go create mode 100644 examples/v2/service-definition/DeleteServiceDefinition.go create mode 100644 examples/v2/service-definition/GetServiceDefinition.go create mode 100644 examples/v2/service-definition/ListServiceDefinitions.go create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.yaml create mode 100644 tests/scenarios/features/v2/service_definition.feature diff --git a/.apigentools-info b/.apigentools-info index ee675d99a50..38cbcd8c94c 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-10-07 18:45:11.142130", - "spec_repo_commit": "e5a0f5b3" + "regenerated": "2022-10-12 15:56:51.107810", + "spec_repo_commit": "9f80a9c5" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-10-07 18:45:11.155130", - "spec_repo_commit": "e5a0f5b3" + "regenerated": "2022-10-12 15:56:51.122956", + "spec_repo_commit": "9f80a9c5" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6a804e1693f..da02a9204bd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -310,6 +310,14 @@ components: schema: example: 00000000-0000-1234-0000-000000000000 type: string + ServiceName: + description: The name of the service. + in: path + name: service_name + required: true + schema: + example: my-service + type: string SignalID: description: The ID of the signal. in: path @@ -8371,6 +8379,468 @@ components: required: - data type: object + ServiceDefinitionCreateResponse: + description: Create service definitions response. + properties: + data: + description: Create service definitions response payload. + items: + $ref: '#/components/schemas/ServiceDefinitionData' + type: array + type: object + ServiceDefinitionData: + description: Service definition data. + properties: + attributes: + $ref: '#/components/schemas/ServiceDefinitionDataAttributes' + type: + description: Service definition type. + type: string + type: object + ServiceDefinitionDataAttributes: + description: Service definition attributes. + properties: + meta: + $ref: '#/components/schemas/ServiceDefinitionMeta' + schema: + $ref: '#/components/schemas/ServiceDefinitionSchema' + type: object + ServiceDefinitionGetResponse: + description: Get service definition response. + properties: + data: + $ref: '#/components/schemas/ServiceDefinitionData' + type: object + ServiceDefinitionMeta: + description: Metadata about a service definition. + properties: + github-html-url: + description: GitHub HTML URL. + type: string + ingested-schema-version: + description: Ingestion schema version. + type: string + ingestion-source: + description: Ingestion source of the service definition. + type: string + last-modified-time: + description: Last modified time of the service definition. + type: string + type: object + ServiceDefinitionRaw: + description: Service Definition in raw JSON/YAML representation. + example: '--- + + schema-version: v2 + + dd-service: my-service + + ' + type: string + ServiceDefinitionSchema: + description: Service definition schema. + oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV1' + - $ref: '#/components/schemas/ServiceDefinitionV2' + type: object + ServiceDefinitionV1: + deprecated: true + description: Deprecated - Service definition V1 for providing additional service + metadata and integrations. + properties: + contact: + $ref: '#/components/schemas/ServiceDefinitionV1Contact' + extensions: + additionalProperties: {} + description: Extensions to V1 schema. + example: + myorg/extension: extensionValue + type: object + external-resources: + description: A list of external links related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV1Resource' + type: array + info: + $ref: '#/components/schemas/ServiceDefinitionV1Info' + integrations: + $ref: '#/components/schemas/ServiceDefinitionV1Integrations' + org: + $ref: '#/components/schemas/ServiceDefinitionV1Org' + schema-version: + $ref: '#/components/schemas/ServiceDefinitionV1Version' + tags: + description: A set of custom tags. + example: + - my:tag + - service:tag + items: + type: string + type: array + required: + - schema-version + - info + type: object + ServiceDefinitionV1Contact: + description: Contact information about the service. + properties: + email: + description: "Service owner\u2019s email." + example: contact@datadoghq.com + format: email + type: string + slack: + description: "Service owner\u2019s Slack channel." + example: https://yourcompany.slack.com/archives/channel123 + type: string + ServiceDefinitionV1Info: + description: Basic information about a service. + properties: + 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: myservice + type: string + description: + description: A short description of the service. + example: A shopping cart service + type: string + display-name: + description: A friendly name of the service. + example: My Service + type: string + service-tier: + description: Service tier. + example: Tier 1 + type: string + required: + - dd-service + type: object + ServiceDefinitionV1Integrations: + description: Third party integrations that Datadog supports. + properties: + pagerduty: + $ref: '#/components/schemas/ServiceDefinitionV1Pagerduty' + type: object + ServiceDefinitionV1Org: + description: Org related information about the service. + properties: + application: + description: App feature this service supports. + example: E-Commerce + type: string + team: + description: Team that owns the service. + example: my-team + type: string + type: object + ServiceDefinitionV1Pagerduty: + description: PagerDuty service URL for the service. + example: https://my-org.pagerduty.com/service-directory/PMyService + type: string + ServiceDefinitionV1Resource: + description: Service's external links. + properties: + name: + description: Link name. + example: Runbook + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV1ResourceType' + url: + description: Link URL. + example: https://my-runbook + type: string + required: + - name + - type + - url + type: object + ServiceDefinitionV1ResourceType: + description: Link type. + enum: + - doc + - wiki + - runbook + - url + - repo + - dashboard + - oncall + - code + - link + example: runbook + type: string + x-enum-varnames: + - DOC + - WIKI + - RUNBOOK + - URL + - REPO + - DASHBOARD + - ONCALL + - CODE + - LINK + ServiceDefinitionV1Version: + default: v1 + description: Schema version being used. + enum: + - v1 + example: v1 + type: string + x-enum-varnames: + - V1 + ServiceDefinitionV2: + description: Service definition V2 for providing service metadata and integrations. + properties: + contacts: + description: A list of contacts related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Contact' + 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 + dd-team: + description: Experimental feature. A Team handle that matches a Team in + the Datadog Teams product. + example: my-team + type: string + docs: + description: A list of documentation related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Doc' + type: array + extensions: + additionalProperties: {} + description: Extensions to V2 schema. + example: + myorg/extension: extensionValue + type: object + integrations: + $ref: '#/components/schemas/ServiceDefinitionV2Integrations' + links: + description: A list of links related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Link' + type: array + repos: + description: A list of code repositories related to the services. + items: + $ref: '#/components/schemas/ServiceDefinitionV2Repo' + type: array + schema-version: + $ref: '#/components/schemas/ServiceDefinitionV2Version' + tags: + description: A set of custom tags. + example: + - my:tag + - service:tag + items: + type: string + type: array + team: + description: Team that owns the service. + example: my-team + type: string + required: + - schema-version + - dd-service + type: object + ServiceDefinitionV2Contact: + description: Service owner's contacts information. + oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2Email' + - $ref: '#/components/schemas/ServiceDefinitionV2Slack' + ServiceDefinitionV2Doc: + description: Service documents. + properties: + name: + description: Document name. + example: Architecture + type: string + provider: + description: Document provider. + example: google drive + type: string + url: + description: Document URL. + example: https://gdrive/mydoc + type: string + required: + - name + - url + type: object + ServiceDefinitionV2Email: + 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/ServiceDefinitionV2EmailType' + required: + - type + - contact + type: object + ServiceDefinitionV2EmailType: + description: Contact type. + enum: + - email + example: email + type: string + x-enum-varnames: + - EMAIL + ServiceDefinitionV2Integrations: + description: Third party integrations that Datadog supports. + properties: + opsgenie: + $ref: '#/components/schemas/ServiceDefinitionV2Opsgenie' + pagerduty: + $ref: '#/components/schemas/ServiceDefinitionV2Pagerduty' + type: object + ServiceDefinitionV2Link: + description: Service's external links. + properties: + name: + description: Link name. + example: Runbook + type: string + type: + $ref: '#/components/schemas/ServiceDefinitionV2LinkType' + url: + description: Link URL. + example: https://my-runbook + type: string + required: + - name + - type + - url + type: object + ServiceDefinitionV2LinkType: + description: Link type. + enum: + - doc + - wiki + - runbook + - url + - repo + - dashboard + - oncall + - code + - link + example: runbook + type: string + x-enum-varnames: + - DOC + - WIKI + - RUNBOOK + - URL + - REPO + - DASHBOARD + - ONCALL + - CODE + - LINK + ServiceDefinitionV2Opsgenie: + description: Opsgenie integration for the service. + properties: + region: + $ref: '#/components/schemas/ServiceDefinitionV2OpsgenieRegion' + service-id: + description: Opsgenie service id. + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + required: + - service-id + type: object + ServiceDefinitionV2OpsgenieRegion: + description: Opsgenie instance region. + enum: + - US + - EU + example: US + type: string + x-enum-varnames: + - US + - EU + ServiceDefinitionV2Pagerduty: + description: PagerDuty service URL for the service. + example: https://my-org.pagerduty.com/service-directory/PMyService + type: string + ServiceDefinitionV2Repo: + description: Service code repositories. + properties: + name: + description: Repository name. + example: Source Code + type: string + provider: + description: Repository provider. + example: GitHub + type: string + url: + description: Repository URL. + example: https://github.com/DataDog/schema + type: string + required: + - name + - url + type: object + ServiceDefinitionV2Slack: + 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/ServiceDefinitionV2SlackType' + required: + - type + - contact + type: object + ServiceDefinitionV2SlackType: + description: Contact type. + enum: + - slack + example: slack + type: string + x-enum-varnames: + - SLACK + ServiceDefinitionV2Version: + default: v2 + description: Schema version being used. + enum: + - v2 + example: v2 + type: string + x-enum-varnames: + - V2 + ServiceDefinitionsCreateRequest: + description: Create service definitions request. + oneOf: + - $ref: '#/components/schemas/ServiceDefinitionV2' + - $ref: '#/components/schemas/ServiceDefinitionRaw' + ServiceDefinitionsListResponse: + description: Create service definitions response. + properties: + data: + description: Data representing service definitions. + items: + $ref: '#/components/schemas/ServiceDefinitionData' + type: array + type: object UsageApplicationSecurityMonitoringResponse: description: Application Security Monitoring usage response. properties: @@ -13920,6 +14390,99 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/services/definitions: + get: + description: Get a list of all service definitions from the Datadog Service + Catalog. + operationId: ListServiceDefinitions + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceDefinitionsListResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all service definitions + tags: + - Service Definition + post: + description: Create or update service definition in the Datadog Service Catalog. + operationId: CreateOrUpdateServiceDefinitions + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceDefinitionsCreateRequest' + description: Service Definition YAML/JSON. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceDefinitionCreateResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create or update service definition + tags: + - Service Definition + x-codegen-request-body-name: body + /api/v2/services/definitions/{service_name}: + delete: + description: Delete a single service definition in the Datadog Service Catalog. + operationId: DeleteServiceDefinition + parameters: + - $ref: '#/components/parameters/ServiceName' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a single service definition + tags: + - Service Definition + get: + description: Get a single service definition from the Datadog Service Catalog. + operationId: GetServiceDefinition + parameters: + - $ref: '#/components/parameters/ServiceName' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceDefinitionGetResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a single service definition + tags: + - Service Definition /api/v2/services/{service_id}: delete: description: Deletes an existing incident service. @@ -15258,6 +15821,10 @@ tags: name: Security Monitoring - description: Create, edit, and disable service accounts. name: Service Accounts +- description: API to create, update, retrieve and delete service definitions. + externalDocs: + url: https://docs.datadoghq.com/tracing/service_catalog/ + name: Service Definition - description: 'The usage metering API allows you to get hourly, daily, and monthly usage across multiple facets of Datadog. diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index a57eca41b40..cd24e091283 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -512,9 +512,9 @@ def format_data_with_schema_list( print(f"{e}") if matched == 0: - raise ValueError(f"[{matched}] {data} is not valid for schema {name}") + raise ValueError(f"[{matched}] {data} is not valid for schema {schema}") elif matched > 1: - warnings.warn(f"[{matched}] {data} is not valid for schema {name}") + warnings.warn(f"[{matched}] {data} is not valid for schema {schema}") one_of_schema_name = simple_type(one_of_schema) or f"{schema_name(one_of_schema)}" reference = "" if one_of_schema.get("required", False) else "&" @@ -684,7 +684,14 @@ def format_data_with_schema_dict( return f"{reference}{name_prefix}{name}{{\n{one_of_schema_name}: {parameters}}}" if schema.get("type") == "object" and "properties" not in schema: - return "new(interface{})" + if schema.get("additionalProperties") == {}: + name_prefix = "" + name = "map[string]interface{}" + reference = "" + for k, v in data.items(): + parameters += f'"{k}": "{v}",\n' + else: + return "new(interface{})" if not name: warnings.warn(f"Unnamed schema {schema} for {data}") diff --git a/api/datadogV2/api_service_definition.go b/api/datadogV2/api_service_definition.go new file mode 100644 index 00000000000..18e35929217 --- /dev/null +++ b/api/datadogV2/api_service_definition.go @@ -0,0 +1,493 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "bytes" + _context "context" + _io "io" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ServiceDefinitionApi service type +type ServiceDefinitionApi datadog.Service + +type apiCreateOrUpdateServiceDefinitionsRequest struct { + ctx _context.Context + body *ServiceDefinitionsCreateRequest +} + +func (a *ServiceDefinitionApi) buildCreateOrUpdateServiceDefinitionsRequest(ctx _context.Context, body ServiceDefinitionsCreateRequest) (apiCreateOrUpdateServiceDefinitionsRequest, error) { + req := apiCreateOrUpdateServiceDefinitionsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateOrUpdateServiceDefinitions Create or update service definition. +// Create or update service definition in the Datadog Service Catalog. +func (a *ServiceDefinitionApi) CreateOrUpdateServiceDefinitions(ctx _context.Context, body ServiceDefinitionsCreateRequest) (ServiceDefinitionCreateResponse, *_nethttp.Response, error) { + req, err := a.buildCreateOrUpdateServiceDefinitionsRequest(ctx, body) + if err != nil { + var localVarReturnValue ServiceDefinitionCreateResponse + return localVarReturnValue, nil, err + } + + return a.createOrUpdateServiceDefinitionsExecute(req) +} + +// createOrUpdateServiceDefinitionsExecute executes the request. +func (a *ServiceDefinitionApi) createOrUpdateServiceDefinitionsExecute(r apiCreateOrUpdateServiceDefinitionsRequest) (ServiceDefinitionCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue ServiceDefinitionCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceDefinitionApi.CreateOrUpdateServiceDefinitions") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/definitions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, datadog.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteServiceDefinitionRequest struct { + ctx _context.Context + serviceName string +} + +func (a *ServiceDefinitionApi) buildDeleteServiceDefinitionRequest(ctx _context.Context, serviceName string) (apiDeleteServiceDefinitionRequest, error) { + req := apiDeleteServiceDefinitionRequest{ + ctx: ctx, + serviceName: serviceName, + } + return req, nil +} + +// DeleteServiceDefinition Delete a single service definition. +// Delete a single service definition in the Datadog Service Catalog. +func (a *ServiceDefinitionApi) DeleteServiceDefinition(ctx _context.Context, serviceName string) (*_nethttp.Response, error) { + req, err := a.buildDeleteServiceDefinitionRequest(ctx, serviceName) + if err != nil { + return nil, err + } + + return a.deleteServiceDefinitionExecute(req) +} + +// deleteServiceDefinitionExecute executes the request. +func (a *ServiceDefinitionApi) deleteServiceDefinitionExecute(r apiDeleteServiceDefinitionRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceDefinitionApi.DeleteServiceDefinition") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/definitions/{service_name}" + localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(datadog.ParameterToString(r.serviceName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetServiceDefinitionRequest struct { + ctx _context.Context + serviceName string +} + +func (a *ServiceDefinitionApi) buildGetServiceDefinitionRequest(ctx _context.Context, serviceName string) (apiGetServiceDefinitionRequest, error) { + req := apiGetServiceDefinitionRequest{ + ctx: ctx, + serviceName: serviceName, + } + return req, nil +} + +// GetServiceDefinition Get a single service definition. +// Get a single service definition from the Datadog Service Catalog. +func (a *ServiceDefinitionApi) GetServiceDefinition(ctx _context.Context, serviceName string) (ServiceDefinitionGetResponse, *_nethttp.Response, error) { + req, err := a.buildGetServiceDefinitionRequest(ctx, serviceName) + if err != nil { + var localVarReturnValue ServiceDefinitionGetResponse + return localVarReturnValue, nil, err + } + + return a.getServiceDefinitionExecute(req) +} + +// getServiceDefinitionExecute executes the request. +func (a *ServiceDefinitionApi) getServiceDefinitionExecute(r apiGetServiceDefinitionRequest) (ServiceDefinitionGetResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ServiceDefinitionGetResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceDefinitionApi.GetServiceDefinition") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/definitions/{service_name}" + localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(datadog.ParameterToString(r.serviceName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListServiceDefinitionsRequest struct { + ctx _context.Context +} + +func (a *ServiceDefinitionApi) buildListServiceDefinitionsRequest(ctx _context.Context) (apiListServiceDefinitionsRequest, error) { + req := apiListServiceDefinitionsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListServiceDefinitions Get all service definitions. +// Get a list of all service definitions from the Datadog Service Catalog. +func (a *ServiceDefinitionApi) ListServiceDefinitions(ctx _context.Context) (ServiceDefinitionsListResponse, *_nethttp.Response, error) { + req, err := a.buildListServiceDefinitionsRequest(ctx) + if err != nil { + var localVarReturnValue ServiceDefinitionsListResponse + return localVarReturnValue, nil, err + } + + return a.listServiceDefinitionsExecute(req) +} + +// listServiceDefinitionsExecute executes the request. +func (a *ServiceDefinitionApi) listServiceDefinitionsExecute(r apiListServiceDefinitionsRequest) (ServiceDefinitionsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ServiceDefinitionsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceDefinitionApi.ListServiceDefinitions") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/definitions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(datadog.ContextAPIKeys).(map[string]datadog.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewServiceDefinitionApi Returns NewServiceDefinitionApi. +func NewServiceDefinitionApi(client *datadog.APIClient) *ServiceDefinitionApi { + return &ServiceDefinitionApi{ + Client: client, + } +} diff --git a/api/datadogV2/model_service_definition_create_response.go b/api/datadogV2/model_service_definition_create_response.go new file mode 100644 index 00000000000..772c62bb48d --- /dev/null +++ b/api/datadogV2/model_service_definition_create_response.go @@ -0,0 +1,98 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionCreateResponse Create service definitions response. +type ServiceDefinitionCreateResponse struct { + // Create service definitions response payload. + Data []ServiceDefinitionData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionCreateResponse instantiates a new ServiceDefinitionCreateResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionCreateResponse() *ServiceDefinitionCreateResponse { + this := ServiceDefinitionCreateResponse{} + return &this +} + +// NewServiceDefinitionCreateResponseWithDefaults instantiates a new ServiceDefinitionCreateResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionCreateResponseWithDefaults() *ServiceDefinitionCreateResponse { + this := ServiceDefinitionCreateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ServiceDefinitionCreateResponse) GetData() []ServiceDefinitionData { + if o == nil || o.Data == nil { + var ret []ServiceDefinitionData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionCreateResponse) GetDataOk() (*[]ServiceDefinitionData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ServiceDefinitionCreateResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []ServiceDefinitionData and assigns it to the Data field. +func (o *ServiceDefinitionCreateResponse) SetData(v []ServiceDefinitionData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []ServiceDefinitionData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/datadogV2/model_service_definition_data.go b/api/datadogV2/model_service_definition_data.go new file mode 100644 index 00000000000..cdf69910f6d --- /dev/null +++ b/api/datadogV2/model_service_definition_data.go @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionData Service definition data. +type ServiceDefinitionData struct { + // Service definition attributes. + Attributes *ServiceDefinitionDataAttributes `json:"attributes,omitempty"` + // Service definition type. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionData instantiates a new ServiceDefinitionData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionData() *ServiceDefinitionData { + this := ServiceDefinitionData{} + return &this +} + +// NewServiceDefinitionDataWithDefaults instantiates a new ServiceDefinitionData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionDataWithDefaults() *ServiceDefinitionData { + this := ServiceDefinitionData{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *ServiceDefinitionData) GetAttributes() ServiceDefinitionDataAttributes { + if o == nil || o.Attributes == nil { + var ret ServiceDefinitionDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionData) GetAttributesOk() (*ServiceDefinitionDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *ServiceDefinitionData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given ServiceDefinitionDataAttributes and assigns it to the Attributes field. +func (o *ServiceDefinitionData) SetAttributes(v ServiceDefinitionDataAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ServiceDefinitionData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ServiceDefinitionData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ServiceDefinitionData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *ServiceDefinitionDataAttributes `json:"attributes,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/datadogV2/model_service_definition_data_attributes.go b/api/datadogV2/model_service_definition_data_attributes.go new file mode 100644 index 00000000000..b2619bdfe85 --- /dev/null +++ b/api/datadogV2/model_service_definition_data_attributes.go @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionDataAttributes Service definition attributes. +type ServiceDefinitionDataAttributes struct { + // Metadata about a service definition. + Meta *ServiceDefinitionMeta `json:"meta,omitempty"` + // Service definition schema. + Schema *ServiceDefinitionSchema `json:"schema,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionDataAttributes instantiates a new ServiceDefinitionDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionDataAttributes() *ServiceDefinitionDataAttributes { + this := ServiceDefinitionDataAttributes{} + return &this +} + +// NewServiceDefinitionDataAttributesWithDefaults instantiates a new ServiceDefinitionDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionDataAttributesWithDefaults() *ServiceDefinitionDataAttributes { + this := ServiceDefinitionDataAttributes{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *ServiceDefinitionDataAttributes) GetMeta() ServiceDefinitionMeta { + if o == nil || o.Meta == nil { + var ret ServiceDefinitionMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionDataAttributes) GetMetaOk() (*ServiceDefinitionMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *ServiceDefinitionDataAttributes) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given ServiceDefinitionMeta and assigns it to the Meta field. +func (o *ServiceDefinitionDataAttributes) SetMeta(v ServiceDefinitionMeta) { + o.Meta = &v +} + +// GetSchema returns the Schema field value if set, zero value otherwise. +func (o *ServiceDefinitionDataAttributes) GetSchema() ServiceDefinitionSchema { + if o == nil || o.Schema == nil { + var ret ServiceDefinitionSchema + return ret + } + return *o.Schema +} + +// GetSchemaOk returns a tuple with the Schema field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionDataAttributes) GetSchemaOk() (*ServiceDefinitionSchema, bool) { + if o == nil || o.Schema == nil { + return nil, false + } + return o.Schema, true +} + +// HasSchema returns a boolean if a field has been set. +func (o *ServiceDefinitionDataAttributes) HasSchema() bool { + return o != nil && o.Schema != nil +} + +// SetSchema gets a reference to the given ServiceDefinitionSchema and assigns it to the Schema field. +func (o *ServiceDefinitionDataAttributes) SetSchema(v ServiceDefinitionSchema) { + o.Schema = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + if o.Schema != nil { + toSerialize["schema"] = o.Schema + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Meta *ServiceDefinitionMeta `json:"meta,omitempty"` + Schema *ServiceDefinitionSchema `json:"schema,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + o.Schema = all.Schema + return nil +} diff --git a/api/datadogV2/model_service_definition_get_response.go b/api/datadogV2/model_service_definition_get_response.go new file mode 100644 index 00000000000..efc6b6dff1d --- /dev/null +++ b/api/datadogV2/model_service_definition_get_response.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionGetResponse Get service definition response. +type ServiceDefinitionGetResponse struct { + // Service definition data. + Data *ServiceDefinitionData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionGetResponse instantiates a new ServiceDefinitionGetResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionGetResponse() *ServiceDefinitionGetResponse { + this := ServiceDefinitionGetResponse{} + return &this +} + +// NewServiceDefinitionGetResponseWithDefaults instantiates a new ServiceDefinitionGetResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionGetResponseWithDefaults() *ServiceDefinitionGetResponse { + this := ServiceDefinitionGetResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ServiceDefinitionGetResponse) GetData() ServiceDefinitionData { + if o == nil || o.Data == nil { + var ret ServiceDefinitionData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionGetResponse) GetDataOk() (*ServiceDefinitionData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ServiceDefinitionGetResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given ServiceDefinitionData and assigns it to the Data field. +func (o *ServiceDefinitionGetResponse) SetData(v ServiceDefinitionData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionGetResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionGetResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *ServiceDefinitionData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/datadogV2/model_service_definition_meta.go b/api/datadogV2/model_service_definition_meta.go new file mode 100644 index 00000000000..68f52e9f911 --- /dev/null +++ b/api/datadogV2/model_service_definition_meta.go @@ -0,0 +1,203 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionMeta Metadata about a service definition. +type ServiceDefinitionMeta struct { + // GitHub HTML URL. + GithubHtmlUrl *string `json:"github-html-url,omitempty"` + // Ingestion schema version. + IngestedSchemaVersion *string `json:"ingested-schema-version,omitempty"` + // Ingestion source of the service definition. + IngestionSource *string `json:"ingestion-source,omitempty"` + // Last modified time of the service definition. + LastModifiedTime *string `json:"last-modified-time,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionMeta instantiates a new ServiceDefinitionMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionMeta() *ServiceDefinitionMeta { + this := ServiceDefinitionMeta{} + return &this +} + +// NewServiceDefinitionMetaWithDefaults instantiates a new ServiceDefinitionMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionMetaWithDefaults() *ServiceDefinitionMeta { + this := ServiceDefinitionMeta{} + return &this +} + +// GetGithubHtmlUrl returns the GithubHtmlUrl field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetGithubHtmlUrl() string { + if o == nil || o.GithubHtmlUrl == nil { + var ret string + return ret + } + return *o.GithubHtmlUrl +} + +// GetGithubHtmlUrlOk returns a tuple with the GithubHtmlUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetGithubHtmlUrlOk() (*string, bool) { + if o == nil || o.GithubHtmlUrl == nil { + return nil, false + } + return o.GithubHtmlUrl, true +} + +// HasGithubHtmlUrl returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasGithubHtmlUrl() bool { + return o != nil && o.GithubHtmlUrl != nil +} + +// SetGithubHtmlUrl gets a reference to the given string and assigns it to the GithubHtmlUrl field. +func (o *ServiceDefinitionMeta) SetGithubHtmlUrl(v string) { + o.GithubHtmlUrl = &v +} + +// GetIngestedSchemaVersion returns the IngestedSchemaVersion field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetIngestedSchemaVersion() string { + if o == nil || o.IngestedSchemaVersion == nil { + var ret string + return ret + } + return *o.IngestedSchemaVersion +} + +// GetIngestedSchemaVersionOk returns a tuple with the IngestedSchemaVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetIngestedSchemaVersionOk() (*string, bool) { + if o == nil || o.IngestedSchemaVersion == nil { + return nil, false + } + return o.IngestedSchemaVersion, true +} + +// HasIngestedSchemaVersion returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasIngestedSchemaVersion() bool { + return o != nil && o.IngestedSchemaVersion != nil +} + +// SetIngestedSchemaVersion gets a reference to the given string and assigns it to the IngestedSchemaVersion field. +func (o *ServiceDefinitionMeta) SetIngestedSchemaVersion(v string) { + o.IngestedSchemaVersion = &v +} + +// GetIngestionSource returns the IngestionSource field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetIngestionSource() string { + if o == nil || o.IngestionSource == nil { + var ret string + return ret + } + return *o.IngestionSource +} + +// GetIngestionSourceOk returns a tuple with the IngestionSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetIngestionSourceOk() (*string, bool) { + if o == nil || o.IngestionSource == nil { + return nil, false + } + return o.IngestionSource, true +} + +// HasIngestionSource returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasIngestionSource() bool { + return o != nil && o.IngestionSource != nil +} + +// SetIngestionSource gets a reference to the given string and assigns it to the IngestionSource field. +func (o *ServiceDefinitionMeta) SetIngestionSource(v string) { + o.IngestionSource = &v +} + +// GetLastModifiedTime returns the LastModifiedTime field value if set, zero value otherwise. +func (o *ServiceDefinitionMeta) GetLastModifiedTime() string { + if o == nil || o.LastModifiedTime == nil { + var ret string + return ret + } + return *o.LastModifiedTime +} + +// GetLastModifiedTimeOk returns a tuple with the LastModifiedTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionMeta) GetLastModifiedTimeOk() (*string, bool) { + if o == nil || o.LastModifiedTime == nil { + return nil, false + } + return o.LastModifiedTime, true +} + +// HasLastModifiedTime returns a boolean if a field has been set. +func (o *ServiceDefinitionMeta) HasLastModifiedTime() bool { + return o != nil && o.LastModifiedTime != nil +} + +// SetLastModifiedTime gets a reference to the given string and assigns it to the LastModifiedTime field. +func (o *ServiceDefinitionMeta) SetLastModifiedTime(v string) { + o.LastModifiedTime = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.GithubHtmlUrl != nil { + toSerialize["github-html-url"] = o.GithubHtmlUrl + } + if o.IngestedSchemaVersion != nil { + toSerialize["ingested-schema-version"] = o.IngestedSchemaVersion + } + if o.IngestionSource != nil { + toSerialize["ingestion-source"] = o.IngestionSource + } + if o.LastModifiedTime != nil { + toSerialize["last-modified-time"] = o.LastModifiedTime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + GithubHtmlUrl *string `json:"github-html-url,omitempty"` + IngestedSchemaVersion *string `json:"ingested-schema-version,omitempty"` + IngestionSource *string `json:"ingestion-source,omitempty"` + LastModifiedTime *string `json:"last-modified-time,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.GithubHtmlUrl = all.GithubHtmlUrl + o.IngestedSchemaVersion = all.IngestedSchemaVersion + o.IngestionSource = all.IngestionSource + o.LastModifiedTime = all.LastModifiedTime + return nil +} diff --git a/api/datadogV2/model_service_definition_schema.go b/api/datadogV2/model_service_definition_schema.go new file mode 100644 index 00000000000..edbf8cf4558 --- /dev/null +++ b/api/datadogV2/model_service_definition_schema.go @@ -0,0 +1,155 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionSchema - Service definition schema. +type ServiceDefinitionSchema struct { + ServiceDefinitionV1 *ServiceDefinitionV1 + ServiceDefinitionV2 *ServiceDefinitionV2 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// ServiceDefinitionV1AsServiceDefinitionSchema is a convenience function that returns ServiceDefinitionV1 wrapped in ServiceDefinitionSchema. +func ServiceDefinitionV1AsServiceDefinitionSchema(v *ServiceDefinitionV1) ServiceDefinitionSchema { + return ServiceDefinitionSchema{ServiceDefinitionV1: v} +} + +// ServiceDefinitionV2AsServiceDefinitionSchema is a convenience function that returns ServiceDefinitionV2 wrapped in ServiceDefinitionSchema. +func ServiceDefinitionV2AsServiceDefinitionSchema(v *ServiceDefinitionV2) ServiceDefinitionSchema { + return ServiceDefinitionSchema{ServiceDefinitionV2: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *ServiceDefinitionSchema) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ServiceDefinitionV1 + err = json.Unmarshal(data, &obj.ServiceDefinitionV1) + if err == nil { + if obj.ServiceDefinitionV1 != nil && obj.ServiceDefinitionV1.UnparsedObject == nil { + jsonServiceDefinitionV1, _ := json.Marshal(obj.ServiceDefinitionV1) + if string(jsonServiceDefinitionV1) == "{}" { // empty struct + obj.ServiceDefinitionV1 = nil + } else { + match++ + } + } else { + obj.ServiceDefinitionV1 = nil + } + } else { + obj.ServiceDefinitionV1 = nil + } + + // try to unmarshal data into ServiceDefinitionV2 + err = json.Unmarshal(data, &obj.ServiceDefinitionV2) + if err == nil { + if obj.ServiceDefinitionV2 != nil && obj.ServiceDefinitionV2.UnparsedObject == nil { + jsonServiceDefinitionV2, _ := json.Marshal(obj.ServiceDefinitionV2) + if string(jsonServiceDefinitionV2) == "{}" { // empty struct + obj.ServiceDefinitionV2 = nil + } else { + match++ + } + } else { + obj.ServiceDefinitionV2 = nil + } + } else { + obj.ServiceDefinitionV2 = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.ServiceDefinitionV1 = nil + obj.ServiceDefinitionV2 = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj ServiceDefinitionSchema) MarshalJSON() ([]byte, error) { + if obj.ServiceDefinitionV1 != nil { + return json.Marshal(&obj.ServiceDefinitionV1) + } + + if obj.ServiceDefinitionV2 != nil { + return json.Marshal(&obj.ServiceDefinitionV2) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *ServiceDefinitionSchema) GetActualInstance() interface{} { + if obj.ServiceDefinitionV1 != nil { + return obj.ServiceDefinitionV1 + } + + if obj.ServiceDefinitionV2 != nil { + return obj.ServiceDefinitionV2 + } + + // all schemas are nil + return nil +} + +// NullableServiceDefinitionSchema handles when a null is used for ServiceDefinitionSchema. +type NullableServiceDefinitionSchema struct { + value *ServiceDefinitionSchema + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionSchema) Get() *ServiceDefinitionSchema { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionSchema) Set(val *ServiceDefinitionSchema) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionSchema) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableServiceDefinitionSchema) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionSchema initializes the struct as if Set has been called. +func NewNullableServiceDefinitionSchema(val *ServiceDefinitionSchema) *NullableServiceDefinitionSchema { + return &NullableServiceDefinitionSchema{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionSchema) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionSchema) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v1.go b/api/datadogV2/model_service_definition_v1.go new file mode 100644 index 00000000000..5a057954ec0 --- /dev/null +++ b/api/datadogV2/model_service_definition_v1.go @@ -0,0 +1,386 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV1 Deprecated - Service definition V1 for providing additional service metadata and integrations. +// +// Deprecated: This model is deprecated. +type ServiceDefinitionV1 struct { + // Contact information about the service. + Contact *ServiceDefinitionV1Contact `json:"contact,omitempty"` + // Extensions to V1 schema. + Extensions map[string]interface{} `json:"extensions,omitempty"` + // A list of external links related to the services. + ExternalResources []ServiceDefinitionV1Resource `json:"external-resources,omitempty"` + // Basic information about a service. + Info ServiceDefinitionV1Info `json:"info"` + // Third party integrations that Datadog supports. + Integrations *ServiceDefinitionV1Integrations `json:"integrations,omitempty"` + // Org related information about the service. + Org *ServiceDefinitionV1Org `json:"org,omitempty"` + // Schema version being used. + SchemaVersion ServiceDefinitionV1Version `json:"schema-version"` + // A set of custom tags. + Tags []string `json:"tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV1 instantiates a new ServiceDefinitionV1 object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV1(info ServiceDefinitionV1Info, schemaVersion ServiceDefinitionV1Version) *ServiceDefinitionV1 { + this := ServiceDefinitionV1{} + this.Info = info + this.SchemaVersion = schemaVersion + return &this +} + +// NewServiceDefinitionV1WithDefaults instantiates a new ServiceDefinitionV1 object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV1WithDefaults() *ServiceDefinitionV1 { + this := ServiceDefinitionV1{} + var schemaVersion ServiceDefinitionV1Version = SERVICEDEFINITIONV1VERSION_V1 + this.SchemaVersion = schemaVersion + return &this +} + +// GetContact returns the Contact field value if set, zero value otherwise. +func (o *ServiceDefinitionV1) GetContact() ServiceDefinitionV1Contact { + if o == nil || o.Contact == nil { + var ret ServiceDefinitionV1Contact + return ret + } + return *o.Contact +} + +// GetContactOk returns a tuple with the Contact field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetContactOk() (*ServiceDefinitionV1Contact, bool) { + if o == nil || o.Contact == nil { + return nil, false + } + return o.Contact, true +} + +// HasContact returns a boolean if a field has been set. +func (o *ServiceDefinitionV1) HasContact() bool { + return o != nil && o.Contact != nil +} + +// SetContact gets a reference to the given ServiceDefinitionV1Contact and assigns it to the Contact field. +func (o *ServiceDefinitionV1) SetContact(v ServiceDefinitionV1Contact) { + o.Contact = &v +} + +// GetExtensions returns the Extensions field value if set, zero value otherwise. +func (o *ServiceDefinitionV1) GetExtensions() map[string]interface{} { + if o == nil || o.Extensions == nil { + var ret map[string]interface{} + return ret + } + return o.Extensions +} + +// GetExtensionsOk returns a tuple with the Extensions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetExtensionsOk() (*map[string]interface{}, bool) { + if o == nil || o.Extensions == nil { + return nil, false + } + return &o.Extensions, true +} + +// HasExtensions returns a boolean if a field has been set. +func (o *ServiceDefinitionV1) HasExtensions() bool { + return o != nil && o.Extensions != nil +} + +// SetExtensions gets a reference to the given map[string]interface{} and assigns it to the Extensions field. +func (o *ServiceDefinitionV1) SetExtensions(v map[string]interface{}) { + o.Extensions = v +} + +// GetExternalResources returns the ExternalResources field value if set, zero value otherwise. +func (o *ServiceDefinitionV1) GetExternalResources() []ServiceDefinitionV1Resource { + if o == nil || o.ExternalResources == nil { + var ret []ServiceDefinitionV1Resource + return ret + } + return o.ExternalResources +} + +// GetExternalResourcesOk returns a tuple with the ExternalResources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetExternalResourcesOk() (*[]ServiceDefinitionV1Resource, bool) { + if o == nil || o.ExternalResources == nil { + return nil, false + } + return &o.ExternalResources, true +} + +// HasExternalResources returns a boolean if a field has been set. +func (o *ServiceDefinitionV1) HasExternalResources() bool { + return o != nil && o.ExternalResources != nil +} + +// SetExternalResources gets a reference to the given []ServiceDefinitionV1Resource and assigns it to the ExternalResources field. +func (o *ServiceDefinitionV1) SetExternalResources(v []ServiceDefinitionV1Resource) { + o.ExternalResources = v +} + +// GetInfo returns the Info field value. +func (o *ServiceDefinitionV1) GetInfo() ServiceDefinitionV1Info { + if o == nil { + var ret ServiceDefinitionV1Info + return ret + } + return o.Info +} + +// GetInfoOk returns a tuple with the Info field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetInfoOk() (*ServiceDefinitionV1Info, bool) { + if o == nil { + return nil, false + } + return &o.Info, true +} + +// SetInfo sets field value. +func (o *ServiceDefinitionV1) SetInfo(v ServiceDefinitionV1Info) { + o.Info = v +} + +// GetIntegrations returns the Integrations field value if set, zero value otherwise. +func (o *ServiceDefinitionV1) GetIntegrations() ServiceDefinitionV1Integrations { + if o == nil || o.Integrations == nil { + var ret ServiceDefinitionV1Integrations + return ret + } + return *o.Integrations +} + +// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetIntegrationsOk() (*ServiceDefinitionV1Integrations, bool) { + if o == nil || o.Integrations == nil { + return nil, false + } + return o.Integrations, true +} + +// HasIntegrations returns a boolean if a field has been set. +func (o *ServiceDefinitionV1) HasIntegrations() bool { + return o != nil && o.Integrations != nil +} + +// SetIntegrations gets a reference to the given ServiceDefinitionV1Integrations and assigns it to the Integrations field. +func (o *ServiceDefinitionV1) SetIntegrations(v ServiceDefinitionV1Integrations) { + o.Integrations = &v +} + +// GetOrg returns the Org field value if set, zero value otherwise. +func (o *ServiceDefinitionV1) GetOrg() ServiceDefinitionV1Org { + if o == nil || o.Org == nil { + var ret ServiceDefinitionV1Org + return ret + } + return *o.Org +} + +// GetOrgOk returns a tuple with the Org field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetOrgOk() (*ServiceDefinitionV1Org, bool) { + if o == nil || o.Org == nil { + return nil, false + } + return o.Org, true +} + +// HasOrg returns a boolean if a field has been set. +func (o *ServiceDefinitionV1) HasOrg() bool { + return o != nil && o.Org != nil +} + +// SetOrg gets a reference to the given ServiceDefinitionV1Org and assigns it to the Org field. +func (o *ServiceDefinitionV1) SetOrg(v ServiceDefinitionV1Org) { + o.Org = &v +} + +// GetSchemaVersion returns the SchemaVersion field value. +func (o *ServiceDefinitionV1) GetSchemaVersion() ServiceDefinitionV1Version { + if o == nil { + var ret ServiceDefinitionV1Version + return ret + } + return o.SchemaVersion +} + +// GetSchemaVersionOk returns a tuple with the SchemaVersion field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetSchemaVersionOk() (*ServiceDefinitionV1Version, bool) { + if o == nil { + return nil, false + } + return &o.SchemaVersion, true +} + +// SetSchemaVersion sets field value. +func (o *ServiceDefinitionV1) SetSchemaVersion(v ServiceDefinitionV1Version) { + o.SchemaVersion = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ServiceDefinitionV1) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ServiceDefinitionV1) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ServiceDefinitionV1) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV1) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Contact != nil { + toSerialize["contact"] = o.Contact + } + if o.Extensions != nil { + toSerialize["extensions"] = o.Extensions + } + if o.ExternalResources != nil { + toSerialize["external-resources"] = o.ExternalResources + } + toSerialize["info"] = o.Info + if o.Integrations != nil { + toSerialize["integrations"] = o.Integrations + } + if o.Org != nil { + toSerialize["org"] = o.Org + } + toSerialize["schema-version"] = o.SchemaVersion + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Info *ServiceDefinitionV1Info `json:"info"` + SchemaVersion *ServiceDefinitionV1Version `json:"schema-version"` + }{} + all := struct { + Contact *ServiceDefinitionV1Contact `json:"contact,omitempty"` + Extensions map[string]interface{} `json:"extensions,omitempty"` + ExternalResources []ServiceDefinitionV1Resource `json:"external-resources,omitempty"` + Info ServiceDefinitionV1Info `json:"info"` + Integrations *ServiceDefinitionV1Integrations `json:"integrations,omitempty"` + Org *ServiceDefinitionV1Org `json:"org,omitempty"` + SchemaVersion ServiceDefinitionV1Version `json:"schema-version"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Info == nil { + return fmt.Errorf("required field info missing") + } + if required.SchemaVersion == nil { + return fmt.Errorf("required field schema-version missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.SchemaVersion; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Contact != nil && all.Contact.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Contact = all.Contact + o.Extensions = all.Extensions + o.ExternalResources = all.ExternalResources + if all.Info.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Info = all.Info + if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integrations = all.Integrations + if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Org = all.Org + o.SchemaVersion = all.SchemaVersion + o.Tags = all.Tags + return nil +} diff --git a/api/datadogV2/model_service_definition_v1_contact.go b/api/datadogV2/model_service_definition_v1_contact.go new file mode 100644 index 00000000000..40ef24a199a --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_contact.go @@ -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. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionV1Contact Contact information about the service. +type ServiceDefinitionV1Contact struct { + // Service owner’s email. + Email *string `json:"email,omitempty"` + // Service owner’s Slack channel. + Slack *string `json:"slack,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV1Contact instantiates a new ServiceDefinitionV1Contact object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV1Contact() *ServiceDefinitionV1Contact { + this := ServiceDefinitionV1Contact{} + return &this +} + +// NewServiceDefinitionV1ContactWithDefaults instantiates a new ServiceDefinitionV1Contact object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV1ContactWithDefaults() *ServiceDefinitionV1Contact { + this := ServiceDefinitionV1Contact{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Contact) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Contact) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Contact) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *ServiceDefinitionV1Contact) SetEmail(v string) { + o.Email = &v +} + +// GetSlack returns the Slack field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Contact) GetSlack() string { + if o == nil || o.Slack == nil { + var ret string + return ret + } + return *o.Slack +} + +// GetSlackOk returns a tuple with the Slack field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Contact) GetSlackOk() (*string, bool) { + if o == nil || o.Slack == nil { + return nil, false + } + return o.Slack, true +} + +// HasSlack returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Contact) HasSlack() bool { + return o != nil && o.Slack != nil +} + +// SetSlack gets a reference to the given string and assigns it to the Slack field. +func (o *ServiceDefinitionV1Contact) SetSlack(v string) { + o.Slack = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV1Contact) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Slack != nil { + toSerialize["slack"] = o.Slack + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV1Contact) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Email *string `json:"email,omitempty"` + Slack *string `json:"slack,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Email = all.Email + o.Slack = all.Slack + return nil +} diff --git a/api/datadogV2/model_service_definition_v1_info.go b/api/datadogV2/model_service_definition_v1_info.go new file mode 100644 index 00000000000..274165a4e30 --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_info.go @@ -0,0 +1,208 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV1Info Basic information about a service. +type ServiceDefinitionV1Info struct { + // Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog. + DdService string `json:"dd-service"` + // A short description of the service. + Description *string `json:"description,omitempty"` + // A friendly name of the service. + DisplayName *string `json:"display-name,omitempty"` + // Service tier. + ServiceTier *string `json:"service-tier,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV1Info instantiates a new ServiceDefinitionV1Info object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV1Info(ddService string) *ServiceDefinitionV1Info { + this := ServiceDefinitionV1Info{} + this.DdService = ddService + return &this +} + +// NewServiceDefinitionV1InfoWithDefaults instantiates a new ServiceDefinitionV1Info object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV1InfoWithDefaults() *ServiceDefinitionV1Info { + this := ServiceDefinitionV1Info{} + return &this +} + +// GetDdService returns the DdService field value. +func (o *ServiceDefinitionV1Info) GetDdService() string { + if o == nil { + var ret string + return ret + } + return o.DdService +} + +// GetDdServiceOk returns a tuple with the DdService field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Info) GetDdServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DdService, true +} + +// SetDdService sets field value. +func (o *ServiceDefinitionV1Info) SetDdService(v string) { + o.DdService = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Info) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Info) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Info) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *ServiceDefinitionV1Info) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Info) GetDisplayName() string { + if o == nil || o.DisplayName == nil { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Info) GetDisplayNameOk() (*string, bool) { + if o == nil || o.DisplayName == nil { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Info) HasDisplayName() bool { + return o != nil && o.DisplayName != nil +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *ServiceDefinitionV1Info) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetServiceTier returns the ServiceTier field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Info) GetServiceTier() string { + if o == nil || o.ServiceTier == nil { + var ret string + return ret + } + return *o.ServiceTier +} + +// GetServiceTierOk returns a tuple with the ServiceTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Info) GetServiceTierOk() (*string, bool) { + if o == nil || o.ServiceTier == nil { + return nil, false + } + return o.ServiceTier, true +} + +// HasServiceTier returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Info) HasServiceTier() bool { + return o != nil && o.ServiceTier != nil +} + +// SetServiceTier gets a reference to the given string and assigns it to the ServiceTier field. +func (o *ServiceDefinitionV1Info) SetServiceTier(v string) { + o.ServiceTier = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV1Info) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["dd-service"] = o.DdService + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.DisplayName != nil { + toSerialize["display-name"] = o.DisplayName + } + if o.ServiceTier != nil { + toSerialize["service-tier"] = o.ServiceTier + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV1Info) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DdService *string `json:"dd-service"` + }{} + all := struct { + DdService string `json:"dd-service"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"display-name,omitempty"` + ServiceTier *string `json:"service-tier,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DdService == nil { + return fmt.Errorf("required field dd-service missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DdService = all.DdService + o.Description = all.Description + o.DisplayName = all.DisplayName + o.ServiceTier = all.ServiceTier + return nil +} diff --git a/api/datadogV2/model_service_definition_v1_integrations.go b/api/datadogV2/model_service_definition_v1_integrations.go new file mode 100644 index 00000000000..64f4277ce49 --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_integrations.go @@ -0,0 +1,98 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionV1Integrations Third party integrations that Datadog supports. +type ServiceDefinitionV1Integrations struct { + // PagerDuty service URL for the service. + Pagerduty *string `json:"pagerduty,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV1Integrations instantiates a new ServiceDefinitionV1Integrations object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV1Integrations() *ServiceDefinitionV1Integrations { + this := ServiceDefinitionV1Integrations{} + return &this +} + +// NewServiceDefinitionV1IntegrationsWithDefaults instantiates a new ServiceDefinitionV1Integrations object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV1IntegrationsWithDefaults() *ServiceDefinitionV1Integrations { + this := ServiceDefinitionV1Integrations{} + return &this +} + +// GetPagerduty returns the Pagerduty field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Integrations) GetPagerduty() string { + if o == nil || o.Pagerduty == nil { + var ret string + return ret + } + return *o.Pagerduty +} + +// GetPagerdutyOk returns a tuple with the Pagerduty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Integrations) GetPagerdutyOk() (*string, bool) { + if o == nil || o.Pagerduty == nil { + return nil, false + } + return o.Pagerduty, true +} + +// HasPagerduty returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Integrations) HasPagerduty() bool { + return o != nil && o.Pagerduty != nil +} + +// SetPagerduty gets a reference to the given string and assigns it to the Pagerduty field. +func (o *ServiceDefinitionV1Integrations) SetPagerduty(v string) { + o.Pagerduty = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV1Integrations) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pagerduty != nil { + toSerialize["pagerduty"] = o.Pagerduty + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV1Integrations) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Pagerduty *string `json:"pagerduty,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Pagerduty = all.Pagerduty + return nil +} diff --git a/api/datadogV2/model_service_definition_v1_org.go b/api/datadogV2/model_service_definition_v1_org.go new file mode 100644 index 00000000000..b30193a45fc --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_org.go @@ -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. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionV1Org Org related information about the service. +type ServiceDefinitionV1Org struct { + // App feature this service supports. + Application *string `json:"application,omitempty"` + // Team that owns the service. + Team *string `json:"team,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV1Org instantiates a new ServiceDefinitionV1Org object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV1Org() *ServiceDefinitionV1Org { + this := ServiceDefinitionV1Org{} + return &this +} + +// NewServiceDefinitionV1OrgWithDefaults instantiates a new ServiceDefinitionV1Org object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV1OrgWithDefaults() *ServiceDefinitionV1Org { + this := ServiceDefinitionV1Org{} + return &this +} + +// GetApplication returns the Application field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Org) GetApplication() string { + if o == nil || o.Application == nil { + var ret string + return ret + } + return *o.Application +} + +// GetApplicationOk returns a tuple with the Application field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Org) GetApplicationOk() (*string, bool) { + if o == nil || o.Application == nil { + return nil, false + } + return o.Application, true +} + +// HasApplication returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Org) HasApplication() bool { + return o != nil && o.Application != nil +} + +// SetApplication gets a reference to the given string and assigns it to the Application field. +func (o *ServiceDefinitionV1Org) SetApplication(v string) { + o.Application = &v +} + +// GetTeam returns the Team field value if set, zero value otherwise. +func (o *ServiceDefinitionV1Org) GetTeam() string { + if o == nil || o.Team == nil { + var ret string + return ret + } + return *o.Team +} + +// GetTeamOk returns a tuple with the Team field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Org) GetTeamOk() (*string, bool) { + if o == nil || o.Team == nil { + return nil, false + } + return o.Team, true +} + +// HasTeam returns a boolean if a field has been set. +func (o *ServiceDefinitionV1Org) HasTeam() bool { + return o != nil && o.Team != nil +} + +// SetTeam gets a reference to the given string and assigns it to the Team field. +func (o *ServiceDefinitionV1Org) SetTeam(v string) { + o.Team = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV1Org) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Application != nil { + toSerialize["application"] = o.Application + } + if o.Team != nil { + toSerialize["team"] = o.Team + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV1Org) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Application *string `json:"application,omitempty"` + Team *string `json:"team,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Application = all.Application + o.Team = all.Team + return nil +} diff --git a/api/datadogV2/model_service_definition_v1_resource.go b/api/datadogV2/model_service_definition_v1_resource.go new file mode 100644 index 00000000000..d470a1d8b7f --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_resource.go @@ -0,0 +1,177 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV1Resource Service's external links. +type ServiceDefinitionV1Resource struct { + // Link name. + Name string `json:"name"` + // Link type. + Type ServiceDefinitionV1ResourceType `json:"type"` + // Link URL. + Url string `json:"url"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV1Resource instantiates a new ServiceDefinitionV1Resource object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV1Resource(name string, typeVar ServiceDefinitionV1ResourceType, url string) *ServiceDefinitionV1Resource { + this := ServiceDefinitionV1Resource{} + this.Name = name + this.Type = typeVar + this.Url = url + return &this +} + +// NewServiceDefinitionV1ResourceWithDefaults instantiates a new ServiceDefinitionV1Resource object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV1ResourceWithDefaults() *ServiceDefinitionV1Resource { + this := ServiceDefinitionV1Resource{} + return &this +} + +// GetName returns the Name field value. +func (o *ServiceDefinitionV1Resource) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Resource) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ServiceDefinitionV1Resource) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value. +func (o *ServiceDefinitionV1Resource) GetType() ServiceDefinitionV1ResourceType { + if o == nil { + var ret ServiceDefinitionV1ResourceType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Resource) GetTypeOk() (*ServiceDefinitionV1ResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceDefinitionV1Resource) SetType(v ServiceDefinitionV1ResourceType) { + o.Type = v +} + +// GetUrl returns the Url field value. +func (o *ServiceDefinitionV1Resource) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV1Resource) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *ServiceDefinitionV1Resource) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV1Resource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV1Resource) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Type *ServiceDefinitionV1ResourceType `json:"type"` + Url *string `json:"url"` + }{} + all := struct { + Name string `json:"name"` + Type ServiceDefinitionV1ResourceType `json:"type"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.Type == nil { + return fmt.Errorf("required field type missing") + } + if required.Url == nil { + return fmt.Errorf("required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Type = all.Type + o.Url = all.Url + return nil +} diff --git a/api/datadogV2/model_service_definition_v1_resource_type.go b/api/datadogV2/model_service_definition_v1_resource_type.go new file mode 100644 index 00000000000..7a893aa7727 --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_resource_type.go @@ -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. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV1ResourceType Link type. +type ServiceDefinitionV1ResourceType string + +// List of ServiceDefinitionV1ResourceType. +const ( + SERVICEDEFINITIONV1RESOURCETYPE_DOC ServiceDefinitionV1ResourceType = "doc" + SERVICEDEFINITIONV1RESOURCETYPE_WIKI ServiceDefinitionV1ResourceType = "wiki" + SERVICEDEFINITIONV1RESOURCETYPE_RUNBOOK ServiceDefinitionV1ResourceType = "runbook" + SERVICEDEFINITIONV1RESOURCETYPE_URL ServiceDefinitionV1ResourceType = "url" + SERVICEDEFINITIONV1RESOURCETYPE_REPO ServiceDefinitionV1ResourceType = "repo" + SERVICEDEFINITIONV1RESOURCETYPE_DASHBOARD ServiceDefinitionV1ResourceType = "dashboard" + SERVICEDEFINITIONV1RESOURCETYPE_ONCALL ServiceDefinitionV1ResourceType = "oncall" + SERVICEDEFINITIONV1RESOURCETYPE_CODE ServiceDefinitionV1ResourceType = "code" + SERVICEDEFINITIONV1RESOURCETYPE_LINK ServiceDefinitionV1ResourceType = "link" +) + +var allowedServiceDefinitionV1ResourceTypeEnumValues = []ServiceDefinitionV1ResourceType{ + SERVICEDEFINITIONV1RESOURCETYPE_DOC, + SERVICEDEFINITIONV1RESOURCETYPE_WIKI, + SERVICEDEFINITIONV1RESOURCETYPE_RUNBOOK, + SERVICEDEFINITIONV1RESOURCETYPE_URL, + SERVICEDEFINITIONV1RESOURCETYPE_REPO, + SERVICEDEFINITIONV1RESOURCETYPE_DASHBOARD, + SERVICEDEFINITIONV1RESOURCETYPE_ONCALL, + SERVICEDEFINITIONV1RESOURCETYPE_CODE, + SERVICEDEFINITIONV1RESOURCETYPE_LINK, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV1ResourceType) GetAllowedValues() []ServiceDefinitionV1ResourceType { + return allowedServiceDefinitionV1ResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV1ResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV1ResourceType(value) + return nil +} + +// NewServiceDefinitionV1ResourceTypeFromValue returns a pointer to a valid ServiceDefinitionV1ResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV1ResourceTypeFromValue(v string) (*ServiceDefinitionV1ResourceType, error) { + ev := ServiceDefinitionV1ResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV1ResourceType: valid values are %v", v, allowedServiceDefinitionV1ResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV1ResourceType) IsValid() bool { + for _, existing := range allowedServiceDefinitionV1ResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV1ResourceType value. +func (v ServiceDefinitionV1ResourceType) Ptr() *ServiceDefinitionV1ResourceType { + return &v +} + +// NullableServiceDefinitionV1ResourceType handles when a null is used for ServiceDefinitionV1ResourceType. +type NullableServiceDefinitionV1ResourceType struct { + value *ServiceDefinitionV1ResourceType + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV1ResourceType) Get() *ServiceDefinitionV1ResourceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV1ResourceType) Set(val *ServiceDefinitionV1ResourceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV1ResourceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV1ResourceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV1ResourceType initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV1ResourceType(val *ServiceDefinitionV1ResourceType) *NullableServiceDefinitionV1ResourceType { + return &NullableServiceDefinitionV1ResourceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV1ResourceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV1ResourceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v1_version.go b/api/datadogV2/model_service_definition_v1_version.go new file mode 100644 index 00000000000..362385c4a69 --- /dev/null +++ b/api/datadogV2/model_service_definition_v1_version.go @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV1Version Schema version being used. +type ServiceDefinitionV1Version string + +// List of ServiceDefinitionV1Version. +const ( + SERVICEDEFINITIONV1VERSION_V1 ServiceDefinitionV1Version = "v1" +) + +var allowedServiceDefinitionV1VersionEnumValues = []ServiceDefinitionV1Version{ + SERVICEDEFINITIONV1VERSION_V1, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV1Version) GetAllowedValues() []ServiceDefinitionV1Version { + return allowedServiceDefinitionV1VersionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV1Version) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV1Version(value) + return nil +} + +// NewServiceDefinitionV1VersionFromValue returns a pointer to a valid ServiceDefinitionV1Version +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV1VersionFromValue(v string) (*ServiceDefinitionV1Version, error) { + ev := ServiceDefinitionV1Version(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV1Version: valid values are %v", v, allowedServiceDefinitionV1VersionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV1Version) IsValid() bool { + for _, existing := range allowedServiceDefinitionV1VersionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV1Version value. +func (v ServiceDefinitionV1Version) Ptr() *ServiceDefinitionV1Version { + return &v +} + +// NullableServiceDefinitionV1Version handles when a null is used for ServiceDefinitionV1Version. +type NullableServiceDefinitionV1Version struct { + value *ServiceDefinitionV1Version + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV1Version) Get() *ServiceDefinitionV1Version { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV1Version) Set(val *ServiceDefinitionV1Version) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV1Version) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV1Version) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV1Version initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV1Version(val *ServiceDefinitionV1Version) *NullableServiceDefinitionV1Version { + return &NullableServiceDefinitionV1Version{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV1Version) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV1Version) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v2.go b/api/datadogV2/model_service_definition_v2.go new file mode 100644 index 00000000000..21315dc4292 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2.go @@ -0,0 +1,468 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2 Service definition V2 for providing service metadata and integrations. +type ServiceDefinitionV2 struct { + // A list of contacts related to the services. + Contacts []ServiceDefinitionV2Contact `json:"contacts,omitempty"` + // Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog. + DdService string `json:"dd-service"` + // Experimental feature. A Team handle that matches a Team in the Datadog Teams product. + DdTeam *string `json:"dd-team,omitempty"` + // A list of documentation related to the services. + Docs []ServiceDefinitionV2Doc `json:"docs,omitempty"` + // Extensions to V2 schema. + Extensions map[string]interface{} `json:"extensions,omitempty"` + // Third party integrations that Datadog supports. + Integrations *ServiceDefinitionV2Integrations `json:"integrations,omitempty"` + // A list of links related to the services. + Links []ServiceDefinitionV2Link `json:"links,omitempty"` + // A list of code repositories related to the services. + Repos []ServiceDefinitionV2Repo `json:"repos,omitempty"` + // Schema version being used. + SchemaVersion ServiceDefinitionV2Version `json:"schema-version"` + // A set of custom tags. + Tags []string `json:"tags,omitempty"` + // Team that owns the service. + Team *string `json:"team,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2 instantiates a new ServiceDefinitionV2 object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2(ddService string, schemaVersion ServiceDefinitionV2Version) *ServiceDefinitionV2 { + this := ServiceDefinitionV2{} + this.DdService = ddService + this.SchemaVersion = schemaVersion + return &this +} + +// NewServiceDefinitionV2WithDefaults instantiates a new ServiceDefinitionV2 object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2WithDefaults() *ServiceDefinitionV2 { + this := ServiceDefinitionV2{} + var schemaVersion ServiceDefinitionV2Version = SERVICEDEFINITIONV2VERSION_V2 + this.SchemaVersion = schemaVersion + return &this +} + +// GetContacts returns the Contacts field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetContacts() []ServiceDefinitionV2Contact { + if o == nil || o.Contacts == nil { + var ret []ServiceDefinitionV2Contact + return ret + } + return o.Contacts +} + +// GetContactsOk returns a tuple with the Contacts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetContactsOk() (*[]ServiceDefinitionV2Contact, bool) { + if o == nil || o.Contacts == nil { + return nil, false + } + return &o.Contacts, true +} + +// HasContacts returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasContacts() bool { + return o != nil && o.Contacts != nil +} + +// SetContacts gets a reference to the given []ServiceDefinitionV2Contact and assigns it to the Contacts field. +func (o *ServiceDefinitionV2) SetContacts(v []ServiceDefinitionV2Contact) { + o.Contacts = v +} + +// GetDdService returns the DdService field value. +func (o *ServiceDefinitionV2) GetDdService() string { + if o == nil { + var ret string + return ret + } + return o.DdService +} + +// GetDdServiceOk returns a tuple with the DdService field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetDdServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DdService, true +} + +// SetDdService sets field value. +func (o *ServiceDefinitionV2) SetDdService(v string) { + o.DdService = v +} + +// GetDdTeam returns the DdTeam field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetDdTeam() string { + if o == nil || o.DdTeam == nil { + var ret string + return ret + } + return *o.DdTeam +} + +// GetDdTeamOk returns a tuple with the DdTeam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetDdTeamOk() (*string, bool) { + if o == nil || o.DdTeam == nil { + return nil, false + } + return o.DdTeam, true +} + +// HasDdTeam returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasDdTeam() bool { + return o != nil && o.DdTeam != nil +} + +// SetDdTeam gets a reference to the given string and assigns it to the DdTeam field. +func (o *ServiceDefinitionV2) SetDdTeam(v string) { + o.DdTeam = &v +} + +// GetDocs returns the Docs field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetDocs() []ServiceDefinitionV2Doc { + if o == nil || o.Docs == nil { + var ret []ServiceDefinitionV2Doc + return ret + } + return o.Docs +} + +// GetDocsOk returns a tuple with the Docs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetDocsOk() (*[]ServiceDefinitionV2Doc, bool) { + if o == nil || o.Docs == nil { + return nil, false + } + return &o.Docs, true +} + +// HasDocs returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasDocs() bool { + return o != nil && o.Docs != nil +} + +// SetDocs gets a reference to the given []ServiceDefinitionV2Doc and assigns it to the Docs field. +func (o *ServiceDefinitionV2) SetDocs(v []ServiceDefinitionV2Doc) { + o.Docs = v +} + +// GetExtensions returns the Extensions field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetExtensions() map[string]interface{} { + if o == nil || o.Extensions == nil { + var ret map[string]interface{} + return ret + } + return o.Extensions +} + +// GetExtensionsOk returns a tuple with the Extensions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetExtensionsOk() (*map[string]interface{}, bool) { + if o == nil || o.Extensions == nil { + return nil, false + } + return &o.Extensions, true +} + +// HasExtensions returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasExtensions() bool { + return o != nil && o.Extensions != nil +} + +// SetExtensions gets a reference to the given map[string]interface{} and assigns it to the Extensions field. +func (o *ServiceDefinitionV2) SetExtensions(v map[string]interface{}) { + o.Extensions = v +} + +// GetIntegrations returns the Integrations field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetIntegrations() ServiceDefinitionV2Integrations { + if o == nil || o.Integrations == nil { + var ret ServiceDefinitionV2Integrations + return ret + } + return *o.Integrations +} + +// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetIntegrationsOk() (*ServiceDefinitionV2Integrations, bool) { + if o == nil || o.Integrations == nil { + return nil, false + } + return o.Integrations, true +} + +// HasIntegrations returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasIntegrations() bool { + return o != nil && o.Integrations != nil +} + +// SetIntegrations gets a reference to the given ServiceDefinitionV2Integrations and assigns it to the Integrations field. +func (o *ServiceDefinitionV2) SetIntegrations(v ServiceDefinitionV2Integrations) { + o.Integrations = &v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetLinks() []ServiceDefinitionV2Link { + if o == nil || o.Links == nil { + var ret []ServiceDefinitionV2Link + return ret + } + return o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetLinksOk() (*[]ServiceDefinitionV2Link, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return &o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given []ServiceDefinitionV2Link and assigns it to the Links field. +func (o *ServiceDefinitionV2) SetLinks(v []ServiceDefinitionV2Link) { + o.Links = v +} + +// GetRepos returns the Repos field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetRepos() []ServiceDefinitionV2Repo { + if o == nil || o.Repos == nil { + var ret []ServiceDefinitionV2Repo + return ret + } + return o.Repos +} + +// GetReposOk returns a tuple with the Repos field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetReposOk() (*[]ServiceDefinitionV2Repo, bool) { + if o == nil || o.Repos == nil { + return nil, false + } + return &o.Repos, true +} + +// HasRepos returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasRepos() bool { + return o != nil && o.Repos != nil +} + +// SetRepos gets a reference to the given []ServiceDefinitionV2Repo and assigns it to the Repos field. +func (o *ServiceDefinitionV2) SetRepos(v []ServiceDefinitionV2Repo) { + o.Repos = v +} + +// GetSchemaVersion returns the SchemaVersion field value. +func (o *ServiceDefinitionV2) GetSchemaVersion() ServiceDefinitionV2Version { + if o == nil { + var ret ServiceDefinitionV2Version + return ret + } + return o.SchemaVersion +} + +// GetSchemaVersionOk returns a tuple with the SchemaVersion field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetSchemaVersionOk() (*ServiceDefinitionV2Version, bool) { + if o == nil { + return nil, false + } + return &o.SchemaVersion, true +} + +// SetSchemaVersion sets field value. +func (o *ServiceDefinitionV2) SetSchemaVersion(v ServiceDefinitionV2Version) { + o.SchemaVersion = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ServiceDefinitionV2) SetTags(v []string) { + o.Tags = v +} + +// GetTeam returns the Team field value if set, zero value otherwise. +func (o *ServiceDefinitionV2) GetTeam() string { + if o == nil || o.Team == nil { + var ret string + return ret + } + return *o.Team +} + +// GetTeamOk returns a tuple with the Team field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2) GetTeamOk() (*string, bool) { + if o == nil || o.Team == nil { + return nil, false + } + return o.Team, true +} + +// HasTeam returns a boolean if a field has been set. +func (o *ServiceDefinitionV2) HasTeam() bool { + return o != nil && o.Team != nil +} + +// SetTeam gets a reference to the given string and assigns it to the Team field. +func (o *ServiceDefinitionV2) SetTeam(v string) { + o.Team = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Contacts != nil { + toSerialize["contacts"] = o.Contacts + } + toSerialize["dd-service"] = o.DdService + if o.DdTeam != nil { + toSerialize["dd-team"] = o.DdTeam + } + if o.Docs != nil { + toSerialize["docs"] = o.Docs + } + if o.Extensions != nil { + toSerialize["extensions"] = o.Extensions + } + if o.Integrations != nil { + toSerialize["integrations"] = o.Integrations + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Repos != nil { + toSerialize["repos"] = o.Repos + } + toSerialize["schema-version"] = o.SchemaVersion + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Team != nil { + toSerialize["team"] = o.Team + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DdService *string `json:"dd-service"` + SchemaVersion *ServiceDefinitionV2Version `json:"schema-version"` + }{} + all := struct { + Contacts []ServiceDefinitionV2Contact `json:"contacts,omitempty"` + DdService string `json:"dd-service"` + DdTeam *string `json:"dd-team,omitempty"` + Docs []ServiceDefinitionV2Doc `json:"docs,omitempty"` + Extensions map[string]interface{} `json:"extensions,omitempty"` + Integrations *ServiceDefinitionV2Integrations `json:"integrations,omitempty"` + Links []ServiceDefinitionV2Link `json:"links,omitempty"` + Repos []ServiceDefinitionV2Repo `json:"repos,omitempty"` + SchemaVersion ServiceDefinitionV2Version `json:"schema-version"` + Tags []string `json:"tags,omitempty"` + Team *string `json:"team,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DdService == nil { + return fmt.Errorf("required field dd-service missing") + } + if required.SchemaVersion == nil { + return fmt.Errorf("required field schema-version missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.SchemaVersion; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Contacts = all.Contacts + o.DdService = all.DdService + o.DdTeam = all.DdTeam + o.Docs = all.Docs + o.Extensions = all.Extensions + if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integrations = all.Integrations + o.Links = all.Links + o.Repos = all.Repos + o.SchemaVersion = all.SchemaVersion + o.Tags = all.Tags + o.Team = all.Team + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_contact.go b/api/datadogV2/model_service_definition_v2_contact.go new file mode 100644 index 00000000000..97bbe6797d2 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_contact.go @@ -0,0 +1,155 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionV2Contact - Service owner's contacts information. +type ServiceDefinitionV2Contact struct { + ServiceDefinitionV2Email *ServiceDefinitionV2Email + ServiceDefinitionV2Slack *ServiceDefinitionV2Slack + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// ServiceDefinitionV2EmailAsServiceDefinitionV2Contact is a convenience function that returns ServiceDefinitionV2Email wrapped in ServiceDefinitionV2Contact. +func ServiceDefinitionV2EmailAsServiceDefinitionV2Contact(v *ServiceDefinitionV2Email) ServiceDefinitionV2Contact { + return ServiceDefinitionV2Contact{ServiceDefinitionV2Email: v} +} + +// ServiceDefinitionV2SlackAsServiceDefinitionV2Contact is a convenience function that returns ServiceDefinitionV2Slack wrapped in ServiceDefinitionV2Contact. +func ServiceDefinitionV2SlackAsServiceDefinitionV2Contact(v *ServiceDefinitionV2Slack) ServiceDefinitionV2Contact { + return ServiceDefinitionV2Contact{ServiceDefinitionV2Slack: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *ServiceDefinitionV2Contact) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ServiceDefinitionV2Email + err = json.Unmarshal(data, &obj.ServiceDefinitionV2Email) + if err == nil { + if obj.ServiceDefinitionV2Email != nil && obj.ServiceDefinitionV2Email.UnparsedObject == nil { + jsonServiceDefinitionV2Email, _ := json.Marshal(obj.ServiceDefinitionV2Email) + if string(jsonServiceDefinitionV2Email) == "{}" { // empty struct + obj.ServiceDefinitionV2Email = nil + } else { + match++ + } + } else { + obj.ServiceDefinitionV2Email = nil + } + } else { + obj.ServiceDefinitionV2Email = nil + } + + // try to unmarshal data into ServiceDefinitionV2Slack + err = json.Unmarshal(data, &obj.ServiceDefinitionV2Slack) + if err == nil { + if obj.ServiceDefinitionV2Slack != nil && obj.ServiceDefinitionV2Slack.UnparsedObject == nil { + jsonServiceDefinitionV2Slack, _ := json.Marshal(obj.ServiceDefinitionV2Slack) + if string(jsonServiceDefinitionV2Slack) == "{}" { // empty struct + obj.ServiceDefinitionV2Slack = nil + } else { + match++ + } + } else { + obj.ServiceDefinitionV2Slack = nil + } + } else { + obj.ServiceDefinitionV2Slack = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.ServiceDefinitionV2Email = nil + obj.ServiceDefinitionV2Slack = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj ServiceDefinitionV2Contact) MarshalJSON() ([]byte, error) { + if obj.ServiceDefinitionV2Email != nil { + return json.Marshal(&obj.ServiceDefinitionV2Email) + } + + if obj.ServiceDefinitionV2Slack != nil { + return json.Marshal(&obj.ServiceDefinitionV2Slack) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *ServiceDefinitionV2Contact) GetActualInstance() interface{} { + if obj.ServiceDefinitionV2Email != nil { + return obj.ServiceDefinitionV2Email + } + + if obj.ServiceDefinitionV2Slack != nil { + return obj.ServiceDefinitionV2Slack + } + + // all schemas are nil + return nil +} + +// NullableServiceDefinitionV2Contact handles when a null is used for ServiceDefinitionV2Contact. +type NullableServiceDefinitionV2Contact struct { + value *ServiceDefinitionV2Contact + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV2Contact) Get() *ServiceDefinitionV2Contact { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV2Contact) Set(val *ServiceDefinitionV2Contact) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV2Contact) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableServiceDefinitionV2Contact) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV2Contact initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV2Contact(val *ServiceDefinitionV2Contact) *NullableServiceDefinitionV2Contact { + return &NullableServiceDefinitionV2Contact{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV2Contact) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV2Contact) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v2_doc.go b/api/datadogV2/model_service_definition_v2_doc.go new file mode 100644 index 00000000000..8bfe17bb6e8 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_doc.go @@ -0,0 +1,171 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Doc Service documents. +type ServiceDefinitionV2Doc struct { + // Document name. + Name string `json:"name"` + // Document provider. + Provider *string `json:"provider,omitempty"` + // Document URL. + Url string `json:"url"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Doc instantiates a new ServiceDefinitionV2Doc object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Doc(name string, url string) *ServiceDefinitionV2Doc { + this := ServiceDefinitionV2Doc{} + this.Name = name + this.Url = url + return &this +} + +// NewServiceDefinitionV2DocWithDefaults instantiates a new ServiceDefinitionV2Doc object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2DocWithDefaults() *ServiceDefinitionV2Doc { + this := ServiceDefinitionV2Doc{} + return &this +} + +// GetName returns the Name field value. +func (o *ServiceDefinitionV2Doc) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Doc) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ServiceDefinitionV2Doc) SetName(v string) { + o.Name = v +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Doc) GetProvider() string { + if o == nil || o.Provider == nil { + var ret string + return ret + } + return *o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Doc) GetProviderOk() (*string, bool) { + if o == nil || o.Provider == nil { + return nil, false + } + return o.Provider, true +} + +// HasProvider returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Doc) HasProvider() bool { + return o != nil && o.Provider != nil +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *ServiceDefinitionV2Doc) SetProvider(v string) { + o.Provider = &v +} + +// GetUrl returns the Url field value. +func (o *ServiceDefinitionV2Doc) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Doc) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *ServiceDefinitionV2Doc) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Doc) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Provider != nil { + toSerialize["provider"] = o.Provider + } + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Doc) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Url *string `json:"url"` + }{} + all := struct { + Name string `json:"name"` + Provider *string `json:"provider,omitempty"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.Url == nil { + return fmt.Errorf("required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Provider = all.Provider + o.Url = all.Url + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_email.go b/api/datadogV2/model_service_definition_v2_email.go new file mode 100644 index 00000000000..377e06438fb --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_email.go @@ -0,0 +1,179 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Email Service owner's email. +type ServiceDefinitionV2Email struct { + // Contact value. + Contact string `json:"contact"` + // Contact email. + Name *string `json:"name,omitempty"` + // Contact type. + Type ServiceDefinitionV2EmailType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Email instantiates a new ServiceDefinitionV2Email object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Email(contact string, typeVar ServiceDefinitionV2EmailType) *ServiceDefinitionV2Email { + this := ServiceDefinitionV2Email{} + this.Contact = contact + this.Type = typeVar + return &this +} + +// NewServiceDefinitionV2EmailWithDefaults instantiates a new ServiceDefinitionV2Email object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2EmailWithDefaults() *ServiceDefinitionV2Email { + this := ServiceDefinitionV2Email{} + return &this +} + +// GetContact returns the Contact field value. +func (o *ServiceDefinitionV2Email) GetContact() string { + if o == nil { + var ret string + return ret + } + return o.Contact +} + +// GetContactOk returns a tuple with the Contact field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Email) GetContactOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Contact, true +} + +// SetContact sets field value. +func (o *ServiceDefinitionV2Email) SetContact(v string) { + o.Contact = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Email) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Email) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Email) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServiceDefinitionV2Email) SetName(v string) { + o.Name = &v +} + +// GetType returns the Type field value. +func (o *ServiceDefinitionV2Email) GetType() ServiceDefinitionV2EmailType { + if o == nil { + var ret ServiceDefinitionV2EmailType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Email) GetTypeOk() (*ServiceDefinitionV2EmailType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceDefinitionV2Email) SetType(v ServiceDefinitionV2EmailType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Email) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["contact"] = o.Contact + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Email) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Contact *string `json:"contact"` + Type *ServiceDefinitionV2EmailType `json:"type"` + }{} + all := struct { + Contact string `json:"contact"` + Name *string `json:"name,omitempty"` + Type ServiceDefinitionV2EmailType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if required.Type == nil { + return fmt.Errorf("required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Contact = all.Contact + o.Name = all.Name + o.Type = all.Type + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_email_type.go b/api/datadogV2/model_service_definition_v2_email_type.go new file mode 100644 index 00000000000..b622009bd73 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_email_type.go @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2EmailType Contact type. +type ServiceDefinitionV2EmailType string + +// List of ServiceDefinitionV2EmailType. +const ( + SERVICEDEFINITIONV2EMAILTYPE_EMAIL ServiceDefinitionV2EmailType = "email" +) + +var allowedServiceDefinitionV2EmailTypeEnumValues = []ServiceDefinitionV2EmailType{ + SERVICEDEFINITIONV2EMAILTYPE_EMAIL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV2EmailType) GetAllowedValues() []ServiceDefinitionV2EmailType { + return allowedServiceDefinitionV2EmailTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV2EmailType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV2EmailType(value) + return nil +} + +// NewServiceDefinitionV2EmailTypeFromValue returns a pointer to a valid ServiceDefinitionV2EmailType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV2EmailTypeFromValue(v string) (*ServiceDefinitionV2EmailType, error) { + ev := ServiceDefinitionV2EmailType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV2EmailType: valid values are %v", v, allowedServiceDefinitionV2EmailTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV2EmailType) IsValid() bool { + for _, existing := range allowedServiceDefinitionV2EmailTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV2EmailType value. +func (v ServiceDefinitionV2EmailType) Ptr() *ServiceDefinitionV2EmailType { + return &v +} + +// NullableServiceDefinitionV2EmailType handles when a null is used for ServiceDefinitionV2EmailType. +type NullableServiceDefinitionV2EmailType struct { + value *ServiceDefinitionV2EmailType + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV2EmailType) Get() *ServiceDefinitionV2EmailType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV2EmailType) Set(val *ServiceDefinitionV2EmailType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV2EmailType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV2EmailType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV2EmailType initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV2EmailType(val *ServiceDefinitionV2EmailType) *NullableServiceDefinitionV2EmailType { + return &NullableServiceDefinitionV2EmailType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV2EmailType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV2EmailType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v2_integrations.go b/api/datadogV2/model_service_definition_v2_integrations.go new file mode 100644 index 00000000000..515bcc7ae53 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_integrations.go @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionV2Integrations Third party integrations that Datadog supports. +type ServiceDefinitionV2Integrations struct { + // Opsgenie integration for the service. + Opsgenie *ServiceDefinitionV2Opsgenie `json:"opsgenie,omitempty"` + // PagerDuty service URL for the service. + Pagerduty *string `json:"pagerduty,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Integrations instantiates a new ServiceDefinitionV2Integrations object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Integrations() *ServiceDefinitionV2Integrations { + this := ServiceDefinitionV2Integrations{} + return &this +} + +// NewServiceDefinitionV2IntegrationsWithDefaults instantiates a new ServiceDefinitionV2Integrations object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2IntegrationsWithDefaults() *ServiceDefinitionV2Integrations { + this := ServiceDefinitionV2Integrations{} + return &this +} + +// GetOpsgenie returns the Opsgenie field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Integrations) GetOpsgenie() ServiceDefinitionV2Opsgenie { + if o == nil || o.Opsgenie == nil { + var ret ServiceDefinitionV2Opsgenie + return ret + } + return *o.Opsgenie +} + +// GetOpsgenieOk returns a tuple with the Opsgenie field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Integrations) GetOpsgenieOk() (*ServiceDefinitionV2Opsgenie, bool) { + if o == nil || o.Opsgenie == nil { + return nil, false + } + return o.Opsgenie, true +} + +// HasOpsgenie returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Integrations) HasOpsgenie() bool { + return o != nil && o.Opsgenie != nil +} + +// SetOpsgenie gets a reference to the given ServiceDefinitionV2Opsgenie and assigns it to the Opsgenie field. +func (o *ServiceDefinitionV2Integrations) SetOpsgenie(v ServiceDefinitionV2Opsgenie) { + o.Opsgenie = &v +} + +// GetPagerduty returns the Pagerduty field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Integrations) GetPagerduty() string { + if o == nil || o.Pagerduty == nil { + var ret string + return ret + } + return *o.Pagerduty +} + +// GetPagerdutyOk returns a tuple with the Pagerduty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Integrations) GetPagerdutyOk() (*string, bool) { + if o == nil || o.Pagerduty == nil { + return nil, false + } + return o.Pagerduty, true +} + +// HasPagerduty returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Integrations) HasPagerduty() bool { + return o != nil && o.Pagerduty != nil +} + +// SetPagerduty gets a reference to the given string and assigns it to the Pagerduty field. +func (o *ServiceDefinitionV2Integrations) SetPagerduty(v string) { + o.Pagerduty = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Integrations) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Opsgenie != nil { + toSerialize["opsgenie"] = o.Opsgenie + } + if o.Pagerduty != nil { + toSerialize["pagerduty"] = o.Pagerduty + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Integrations) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Opsgenie *ServiceDefinitionV2Opsgenie `json:"opsgenie,omitempty"` + Pagerduty *string `json:"pagerduty,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Opsgenie != nil && all.Opsgenie.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Opsgenie = all.Opsgenie + o.Pagerduty = all.Pagerduty + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_link.go b/api/datadogV2/model_service_definition_v2_link.go new file mode 100644 index 00000000000..6b73cf24f2a --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_link.go @@ -0,0 +1,177 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Link Service's external links. +type ServiceDefinitionV2Link struct { + // Link name. + Name string `json:"name"` + // Link type. + Type ServiceDefinitionV2LinkType `json:"type"` + // Link URL. + Url string `json:"url"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Link instantiates a new ServiceDefinitionV2Link object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Link(name string, typeVar ServiceDefinitionV2LinkType, url string) *ServiceDefinitionV2Link { + this := ServiceDefinitionV2Link{} + this.Name = name + this.Type = typeVar + this.Url = url + return &this +} + +// NewServiceDefinitionV2LinkWithDefaults instantiates a new ServiceDefinitionV2Link object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2LinkWithDefaults() *ServiceDefinitionV2Link { + this := ServiceDefinitionV2Link{} + return &this +} + +// GetName returns the Name field value. +func (o *ServiceDefinitionV2Link) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Link) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ServiceDefinitionV2Link) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value. +func (o *ServiceDefinitionV2Link) GetType() ServiceDefinitionV2LinkType { + if o == nil { + var ret ServiceDefinitionV2LinkType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Link) GetTypeOk() (*ServiceDefinitionV2LinkType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceDefinitionV2Link) SetType(v ServiceDefinitionV2LinkType) { + o.Type = v +} + +// GetUrl returns the Url field value. +func (o *ServiceDefinitionV2Link) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Link) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *ServiceDefinitionV2Link) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Link) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Link) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Type *ServiceDefinitionV2LinkType `json:"type"` + Url *string `json:"url"` + }{} + all := struct { + Name string `json:"name"` + Type ServiceDefinitionV2LinkType `json:"type"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.Type == nil { + return fmt.Errorf("required field type missing") + } + if required.Url == nil { + return fmt.Errorf("required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Type = all.Type + o.Url = all.Url + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_link_type.go b/api/datadogV2/model_service_definition_v2_link_type.go new file mode 100644 index 00000000000..68272f98de3 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_link_type.go @@ -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. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2LinkType Link type. +type ServiceDefinitionV2LinkType string + +// List of ServiceDefinitionV2LinkType. +const ( + SERVICEDEFINITIONV2LINKTYPE_DOC ServiceDefinitionV2LinkType = "doc" + SERVICEDEFINITIONV2LINKTYPE_WIKI ServiceDefinitionV2LinkType = "wiki" + SERVICEDEFINITIONV2LINKTYPE_RUNBOOK ServiceDefinitionV2LinkType = "runbook" + SERVICEDEFINITIONV2LINKTYPE_URL ServiceDefinitionV2LinkType = "url" + SERVICEDEFINITIONV2LINKTYPE_REPO ServiceDefinitionV2LinkType = "repo" + SERVICEDEFINITIONV2LINKTYPE_DASHBOARD ServiceDefinitionV2LinkType = "dashboard" + SERVICEDEFINITIONV2LINKTYPE_ONCALL ServiceDefinitionV2LinkType = "oncall" + SERVICEDEFINITIONV2LINKTYPE_CODE ServiceDefinitionV2LinkType = "code" + SERVICEDEFINITIONV2LINKTYPE_LINK ServiceDefinitionV2LinkType = "link" +) + +var allowedServiceDefinitionV2LinkTypeEnumValues = []ServiceDefinitionV2LinkType{ + SERVICEDEFINITIONV2LINKTYPE_DOC, + SERVICEDEFINITIONV2LINKTYPE_WIKI, + SERVICEDEFINITIONV2LINKTYPE_RUNBOOK, + SERVICEDEFINITIONV2LINKTYPE_URL, + SERVICEDEFINITIONV2LINKTYPE_REPO, + SERVICEDEFINITIONV2LINKTYPE_DASHBOARD, + SERVICEDEFINITIONV2LINKTYPE_ONCALL, + SERVICEDEFINITIONV2LINKTYPE_CODE, + SERVICEDEFINITIONV2LINKTYPE_LINK, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV2LinkType) GetAllowedValues() []ServiceDefinitionV2LinkType { + return allowedServiceDefinitionV2LinkTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV2LinkType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV2LinkType(value) + return nil +} + +// NewServiceDefinitionV2LinkTypeFromValue returns a pointer to a valid ServiceDefinitionV2LinkType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV2LinkTypeFromValue(v string) (*ServiceDefinitionV2LinkType, error) { + ev := ServiceDefinitionV2LinkType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV2LinkType: valid values are %v", v, allowedServiceDefinitionV2LinkTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV2LinkType) IsValid() bool { + for _, existing := range allowedServiceDefinitionV2LinkTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV2LinkType value. +func (v ServiceDefinitionV2LinkType) Ptr() *ServiceDefinitionV2LinkType { + return &v +} + +// NullableServiceDefinitionV2LinkType handles when a null is used for ServiceDefinitionV2LinkType. +type NullableServiceDefinitionV2LinkType struct { + value *ServiceDefinitionV2LinkType + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV2LinkType) Get() *ServiceDefinitionV2LinkType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV2LinkType) Set(val *ServiceDefinitionV2LinkType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV2LinkType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV2LinkType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV2LinkType initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV2LinkType(val *ServiceDefinitionV2LinkType) *NullableServiceDefinitionV2LinkType { + return &NullableServiceDefinitionV2LinkType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV2LinkType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV2LinkType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v2_opsgenie.go b/api/datadogV2/model_service_definition_v2_opsgenie.go new file mode 100644 index 00000000000..eb2e6c7dcbb --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_opsgenie.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Opsgenie Opsgenie integration for the service. +type ServiceDefinitionV2Opsgenie struct { + // Opsgenie instance region. + Region *ServiceDefinitionV2OpsgenieRegion `json:"region,omitempty"` + // Opsgenie service id. + ServiceId string `json:"service-id"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Opsgenie instantiates a new ServiceDefinitionV2Opsgenie object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Opsgenie(serviceId string) *ServiceDefinitionV2Opsgenie { + this := ServiceDefinitionV2Opsgenie{} + this.ServiceId = serviceId + return &this +} + +// NewServiceDefinitionV2OpsgenieWithDefaults instantiates a new ServiceDefinitionV2Opsgenie object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2OpsgenieWithDefaults() *ServiceDefinitionV2Opsgenie { + this := ServiceDefinitionV2Opsgenie{} + return &this +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Opsgenie) GetRegion() ServiceDefinitionV2OpsgenieRegion { + if o == nil || o.Region == nil { + var ret ServiceDefinitionV2OpsgenieRegion + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Opsgenie) GetRegionOk() (*ServiceDefinitionV2OpsgenieRegion, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Opsgenie) HasRegion() bool { + return o != nil && o.Region != nil +} + +// SetRegion gets a reference to the given ServiceDefinitionV2OpsgenieRegion and assigns it to the Region field. +func (o *ServiceDefinitionV2Opsgenie) SetRegion(v ServiceDefinitionV2OpsgenieRegion) { + o.Region = &v +} + +// GetServiceId returns the ServiceId field value. +func (o *ServiceDefinitionV2Opsgenie) GetServiceId() string { + if o == nil { + var ret string + return ret + } + return o.ServiceId +} + +// GetServiceIdOk returns a tuple with the ServiceId field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Opsgenie) GetServiceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceId, true +} + +// SetServiceId sets field value. +func (o *ServiceDefinitionV2Opsgenie) SetServiceId(v string) { + o.ServiceId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Opsgenie) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + toSerialize["service-id"] = o.ServiceId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Opsgenie) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ServiceId *string `json:"service-id"` + }{} + all := struct { + Region *ServiceDefinitionV2OpsgenieRegion `json:"region,omitempty"` + ServiceId string `json:"service-id"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ServiceId == nil { + return fmt.Errorf("required field service-id missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Region; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Region = all.Region + o.ServiceId = all.ServiceId + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_opsgenie_region.go b/api/datadogV2/model_service_definition_v2_opsgenie_region.go new file mode 100644 index 00000000000..e1d7d10513a --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_opsgenie_region.go @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2OpsgenieRegion Opsgenie instance region. +type ServiceDefinitionV2OpsgenieRegion string + +// List of ServiceDefinitionV2OpsgenieRegion. +const ( + SERVICEDEFINITIONV2OPSGENIEREGION_US ServiceDefinitionV2OpsgenieRegion = "US" + SERVICEDEFINITIONV2OPSGENIEREGION_EU ServiceDefinitionV2OpsgenieRegion = "EU" +) + +var allowedServiceDefinitionV2OpsgenieRegionEnumValues = []ServiceDefinitionV2OpsgenieRegion{ + SERVICEDEFINITIONV2OPSGENIEREGION_US, + SERVICEDEFINITIONV2OPSGENIEREGION_EU, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV2OpsgenieRegion) GetAllowedValues() []ServiceDefinitionV2OpsgenieRegion { + return allowedServiceDefinitionV2OpsgenieRegionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV2OpsgenieRegion) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV2OpsgenieRegion(value) + return nil +} + +// NewServiceDefinitionV2OpsgenieRegionFromValue returns a pointer to a valid ServiceDefinitionV2OpsgenieRegion +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV2OpsgenieRegionFromValue(v string) (*ServiceDefinitionV2OpsgenieRegion, error) { + ev := ServiceDefinitionV2OpsgenieRegion(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV2OpsgenieRegion: valid values are %v", v, allowedServiceDefinitionV2OpsgenieRegionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV2OpsgenieRegion) IsValid() bool { + for _, existing := range allowedServiceDefinitionV2OpsgenieRegionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV2OpsgenieRegion value. +func (v ServiceDefinitionV2OpsgenieRegion) Ptr() *ServiceDefinitionV2OpsgenieRegion { + return &v +} + +// NullableServiceDefinitionV2OpsgenieRegion handles when a null is used for ServiceDefinitionV2OpsgenieRegion. +type NullableServiceDefinitionV2OpsgenieRegion struct { + value *ServiceDefinitionV2OpsgenieRegion + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV2OpsgenieRegion) Get() *ServiceDefinitionV2OpsgenieRegion { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV2OpsgenieRegion) Set(val *ServiceDefinitionV2OpsgenieRegion) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV2OpsgenieRegion) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV2OpsgenieRegion) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV2OpsgenieRegion initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV2OpsgenieRegion(val *ServiceDefinitionV2OpsgenieRegion) *NullableServiceDefinitionV2OpsgenieRegion { + return &NullableServiceDefinitionV2OpsgenieRegion{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV2OpsgenieRegion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV2OpsgenieRegion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v2_repo.go b/api/datadogV2/model_service_definition_v2_repo.go new file mode 100644 index 00000000000..cd264645010 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_repo.go @@ -0,0 +1,171 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Repo Service code repositories. +type ServiceDefinitionV2Repo struct { + // Repository name. + Name string `json:"name"` + // Repository provider. + Provider *string `json:"provider,omitempty"` + // Repository URL. + Url string `json:"url"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Repo instantiates a new ServiceDefinitionV2Repo object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Repo(name string, url string) *ServiceDefinitionV2Repo { + this := ServiceDefinitionV2Repo{} + this.Name = name + this.Url = url + return &this +} + +// NewServiceDefinitionV2RepoWithDefaults instantiates a new ServiceDefinitionV2Repo object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2RepoWithDefaults() *ServiceDefinitionV2Repo { + this := ServiceDefinitionV2Repo{} + return &this +} + +// GetName returns the Name field value. +func (o *ServiceDefinitionV2Repo) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Repo) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ServiceDefinitionV2Repo) SetName(v string) { + o.Name = v +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Repo) GetProvider() string { + if o == nil || o.Provider == nil { + var ret string + return ret + } + return *o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Repo) GetProviderOk() (*string, bool) { + if o == nil || o.Provider == nil { + return nil, false + } + return o.Provider, true +} + +// HasProvider returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Repo) HasProvider() bool { + return o != nil && o.Provider != nil +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *ServiceDefinitionV2Repo) SetProvider(v string) { + o.Provider = &v +} + +// GetUrl returns the Url field value. +func (o *ServiceDefinitionV2Repo) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Repo) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *ServiceDefinitionV2Repo) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Repo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Provider != nil { + toSerialize["provider"] = o.Provider + } + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Repo) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Url *string `json:"url"` + }{} + all := struct { + Name string `json:"name"` + Provider *string `json:"provider,omitempty"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.Url == nil { + return fmt.Errorf("required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Provider = all.Provider + o.Url = all.Url + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_slack.go b/api/datadogV2/model_service_definition_v2_slack.go new file mode 100644 index 00000000000..5db369aab79 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_slack.go @@ -0,0 +1,179 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Slack Service owner's Slack channel. +type ServiceDefinitionV2Slack struct { + // Slack Channel. + Contact string `json:"contact"` + // Contact Slack. + Name *string `json:"name,omitempty"` + // Contact type. + Type ServiceDefinitionV2SlackType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionV2Slack instantiates a new ServiceDefinitionV2Slack object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionV2Slack(contact string, typeVar ServiceDefinitionV2SlackType) *ServiceDefinitionV2Slack { + this := ServiceDefinitionV2Slack{} + this.Contact = contact + this.Type = typeVar + return &this +} + +// NewServiceDefinitionV2SlackWithDefaults instantiates a new ServiceDefinitionV2Slack object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionV2SlackWithDefaults() *ServiceDefinitionV2Slack { + this := ServiceDefinitionV2Slack{} + return &this +} + +// GetContact returns the Contact field value. +func (o *ServiceDefinitionV2Slack) GetContact() string { + if o == nil { + var ret string + return ret + } + return o.Contact +} + +// GetContactOk returns a tuple with the Contact field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Slack) GetContactOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Contact, true +} + +// SetContact sets field value. +func (o *ServiceDefinitionV2Slack) SetContact(v string) { + o.Contact = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServiceDefinitionV2Slack) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Slack) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServiceDefinitionV2Slack) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServiceDefinitionV2Slack) SetName(v string) { + o.Name = &v +} + +// GetType returns the Type field value. +func (o *ServiceDefinitionV2Slack) GetType() ServiceDefinitionV2SlackType { + if o == nil { + var ret ServiceDefinitionV2SlackType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionV2Slack) GetTypeOk() (*ServiceDefinitionV2SlackType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceDefinitionV2Slack) SetType(v ServiceDefinitionV2SlackType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionV2Slack) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["contact"] = o.Contact + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionV2Slack) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Contact *string `json:"contact"` + Type *ServiceDefinitionV2SlackType `json:"type"` + }{} + all := struct { + Contact string `json:"contact"` + Name *string `json:"name,omitempty"` + Type ServiceDefinitionV2SlackType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if required.Type == nil { + return fmt.Errorf("required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Contact = all.Contact + o.Name = all.Name + o.Type = all.Type + return nil +} diff --git a/api/datadogV2/model_service_definition_v2_slack_type.go b/api/datadogV2/model_service_definition_v2_slack_type.go new file mode 100644 index 00000000000..d16136a0246 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_slack_type.go @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2SlackType Contact type. +type ServiceDefinitionV2SlackType string + +// List of ServiceDefinitionV2SlackType. +const ( + SERVICEDEFINITIONV2SLACKTYPE_SLACK ServiceDefinitionV2SlackType = "slack" +) + +var allowedServiceDefinitionV2SlackTypeEnumValues = []ServiceDefinitionV2SlackType{ + SERVICEDEFINITIONV2SLACKTYPE_SLACK, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV2SlackType) GetAllowedValues() []ServiceDefinitionV2SlackType { + return allowedServiceDefinitionV2SlackTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV2SlackType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV2SlackType(value) + return nil +} + +// NewServiceDefinitionV2SlackTypeFromValue returns a pointer to a valid ServiceDefinitionV2SlackType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV2SlackTypeFromValue(v string) (*ServiceDefinitionV2SlackType, error) { + ev := ServiceDefinitionV2SlackType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV2SlackType: valid values are %v", v, allowedServiceDefinitionV2SlackTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV2SlackType) IsValid() bool { + for _, existing := range allowedServiceDefinitionV2SlackTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV2SlackType value. +func (v ServiceDefinitionV2SlackType) Ptr() *ServiceDefinitionV2SlackType { + return &v +} + +// NullableServiceDefinitionV2SlackType handles when a null is used for ServiceDefinitionV2SlackType. +type NullableServiceDefinitionV2SlackType struct { + value *ServiceDefinitionV2SlackType + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV2SlackType) Get() *ServiceDefinitionV2SlackType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV2SlackType) Set(val *ServiceDefinitionV2SlackType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV2SlackType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV2SlackType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV2SlackType initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV2SlackType(val *ServiceDefinitionV2SlackType) *NullableServiceDefinitionV2SlackType { + return &NullableServiceDefinitionV2SlackType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV2SlackType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV2SlackType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definition_v2_version.go b/api/datadogV2/model_service_definition_v2_version.go new file mode 100644 index 00000000000..bdeea5b4e80 --- /dev/null +++ b/api/datadogV2/model_service_definition_v2_version.go @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + "fmt" +) + +// ServiceDefinitionV2Version Schema version being used. +type ServiceDefinitionV2Version string + +// List of ServiceDefinitionV2Version. +const ( + SERVICEDEFINITIONV2VERSION_V2 ServiceDefinitionV2Version = "v2" +) + +var allowedServiceDefinitionV2VersionEnumValues = []ServiceDefinitionV2Version{ + SERVICEDEFINITIONV2VERSION_V2, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceDefinitionV2Version) GetAllowedValues() []ServiceDefinitionV2Version { + return allowedServiceDefinitionV2VersionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceDefinitionV2Version) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceDefinitionV2Version(value) + return nil +} + +// NewServiceDefinitionV2VersionFromValue returns a pointer to a valid ServiceDefinitionV2Version +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceDefinitionV2VersionFromValue(v string) (*ServiceDefinitionV2Version, error) { + ev := ServiceDefinitionV2Version(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionV2Version: valid values are %v", v, allowedServiceDefinitionV2VersionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceDefinitionV2Version) IsValid() bool { + for _, existing := range allowedServiceDefinitionV2VersionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceDefinitionV2Version value. +func (v ServiceDefinitionV2Version) Ptr() *ServiceDefinitionV2Version { + return &v +} + +// NullableServiceDefinitionV2Version handles when a null is used for ServiceDefinitionV2Version. +type NullableServiceDefinitionV2Version struct { + value *ServiceDefinitionV2Version + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionV2Version) Get() *ServiceDefinitionV2Version { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionV2Version) Set(val *ServiceDefinitionV2Version) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionV2Version) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceDefinitionV2Version) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionV2Version initializes the struct as if Set has been called. +func NewNullableServiceDefinitionV2Version(val *ServiceDefinitionV2Version) *NullableServiceDefinitionV2Version { + return &NullableServiceDefinitionV2Version{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionV2Version) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionV2Version) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definitions_create_request.go b/api/datadogV2/model_service_definitions_create_request.go new file mode 100644 index 00000000000..ff9e9ddf1fa --- /dev/null +++ b/api/datadogV2/model_service_definitions_create_request.go @@ -0,0 +1,155 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionsCreateRequest - Create service definitions request. +type ServiceDefinitionsCreateRequest struct { + ServiceDefinitionV2 *ServiceDefinitionV2 + ServiceDefinitionRaw *string + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// ServiceDefinitionV2AsServiceDefinitionsCreateRequest is a convenience function that returns ServiceDefinitionV2 wrapped in ServiceDefinitionsCreateRequest. +func ServiceDefinitionV2AsServiceDefinitionsCreateRequest(v *ServiceDefinitionV2) ServiceDefinitionsCreateRequest { + return ServiceDefinitionsCreateRequest{ServiceDefinitionV2: v} +} + +// ServiceDefinitionRawAsServiceDefinitionsCreateRequest is a convenience function that returns string wrapped in ServiceDefinitionsCreateRequest. +func ServiceDefinitionRawAsServiceDefinitionsCreateRequest(v *string) ServiceDefinitionsCreateRequest { + return ServiceDefinitionsCreateRequest{ServiceDefinitionRaw: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *ServiceDefinitionsCreateRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ServiceDefinitionV2 + err = json.Unmarshal(data, &obj.ServiceDefinitionV2) + if err == nil { + if obj.ServiceDefinitionV2 != nil && obj.ServiceDefinitionV2.UnparsedObject == nil { + jsonServiceDefinitionV2, _ := json.Marshal(obj.ServiceDefinitionV2) + if string(jsonServiceDefinitionV2) == "{}" { // empty struct + obj.ServiceDefinitionV2 = nil + } else { + match++ + } + } else { + obj.ServiceDefinitionV2 = nil + } + } else { + obj.ServiceDefinitionV2 = nil + } + + // try to unmarshal data into ServiceDefinitionRaw + err = json.Unmarshal(data, &obj.ServiceDefinitionRaw) + if err == nil { + if obj.ServiceDefinitionRaw != nil { + jsonServiceDefinitionRaw, _ := json.Marshal(obj.ServiceDefinitionRaw) + if string(jsonServiceDefinitionRaw) == "{}" { // empty struct + obj.ServiceDefinitionRaw = nil + } else { + match++ + } + } else { + obj.ServiceDefinitionRaw = nil + } + } else { + obj.ServiceDefinitionRaw = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.ServiceDefinitionV2 = nil + obj.ServiceDefinitionRaw = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj ServiceDefinitionsCreateRequest) MarshalJSON() ([]byte, error) { + if obj.ServiceDefinitionV2 != nil { + return json.Marshal(&obj.ServiceDefinitionV2) + } + + if obj.ServiceDefinitionRaw != nil { + return json.Marshal(&obj.ServiceDefinitionRaw) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *ServiceDefinitionsCreateRequest) GetActualInstance() interface{} { + if obj.ServiceDefinitionV2 != nil { + return obj.ServiceDefinitionV2 + } + + if obj.ServiceDefinitionRaw != nil { + return obj.ServiceDefinitionRaw + } + + // all schemas are nil + return nil +} + +// NullableServiceDefinitionsCreateRequest handles when a null is used for ServiceDefinitionsCreateRequest. +type NullableServiceDefinitionsCreateRequest struct { + value *ServiceDefinitionsCreateRequest + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceDefinitionsCreateRequest) Get() *ServiceDefinitionsCreateRequest { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceDefinitionsCreateRequest) Set(val *ServiceDefinitionsCreateRequest) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceDefinitionsCreateRequest) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableServiceDefinitionsCreateRequest) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceDefinitionsCreateRequest initializes the struct as if Set has been called. +func NewNullableServiceDefinitionsCreateRequest(val *ServiceDefinitionsCreateRequest) *NullableServiceDefinitionsCreateRequest { + return &NullableServiceDefinitionsCreateRequest{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceDefinitionsCreateRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceDefinitionsCreateRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_service_definitions_list_response.go b/api/datadogV2/model_service_definitions_list_response.go new file mode 100644 index 00000000000..ce628d583d9 --- /dev/null +++ b/api/datadogV2/model_service_definitions_list_response.go @@ -0,0 +1,98 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" +) + +// ServiceDefinitionsListResponse Create service definitions response. +type ServiceDefinitionsListResponse struct { + // Data representing service definitions. + Data []ServiceDefinitionData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewServiceDefinitionsListResponse instantiates a new ServiceDefinitionsListResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewServiceDefinitionsListResponse() *ServiceDefinitionsListResponse { + this := ServiceDefinitionsListResponse{} + return &this +} + +// NewServiceDefinitionsListResponseWithDefaults instantiates a new ServiceDefinitionsListResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewServiceDefinitionsListResponseWithDefaults() *ServiceDefinitionsListResponse { + this := ServiceDefinitionsListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ServiceDefinitionsListResponse) GetData() []ServiceDefinitionData { + if o == nil || o.Data == nil { + var ret []ServiceDefinitionData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceDefinitionsListResponse) GetDataOk() (*[]ServiceDefinitionData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ServiceDefinitionsListResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []ServiceDefinitionData and assigns it to the Data field. +func (o *ServiceDefinitionsListResponse) SetData(v []ServiceDefinitionData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceDefinitionsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceDefinitionsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []ServiceDefinitionData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.go b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.go new file mode 100644 index 00000000000..c1266d5d8a0 --- /dev/null +++ b/examples/v2/service-definition/CreateOrUpdateServiceDefinitions.go @@ -0,0 +1,79 @@ +// Create or update service definition returns "CREATED" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.ServiceDefinitionsCreateRequest{ + ServiceDefinitionV2: &datadogV2.ServiceDefinitionV2{ + Contacts: []datadogV2.ServiceDefinitionV2Contact{ + datadogV2.ServiceDefinitionV2Contact{ + ServiceDefinitionV2Email: &datadogV2.ServiceDefinitionV2Email{ + Contact: "contact@datadoghq.com", + Name: datadog.PtrString("Team Email"), + Type: datadogV2.SERVICEDEFINITIONV2EMAILTYPE_EMAIL, + }}, + }, + DdService: "service-Example-Create_or_update_service_definition_returns_CREATED_response", + DdTeam: datadog.PtrString("my-team"), + Docs: []datadogV2.ServiceDefinitionV2Doc{ + { + Name: "Architecture", + Provider: datadog.PtrString("google drive"), + Url: "https://gdrive/mydoc", + }, + }, + Extensions: map[string]interface{}{ + "myorgextension": "extensionvalue", + }, + Integrations: &datadogV2.ServiceDefinitionV2Integrations{ + Opsgenie: &datadogV2.ServiceDefinitionV2Opsgenie{ + Region: datadogV2.SERVICEDEFINITIONV2OPSGENIEREGION_US.Ptr(), + ServiceId: "123e4567-e89b-12d3-a456-426614174000", + }, + Pagerduty: datadog.PtrString("https://my-org.pagerduty.com/service-directory/PMyService"), + }, + Links: []datadogV2.ServiceDefinitionV2Link{ + { + Name: "Runbook", + Type: datadogV2.SERVICEDEFINITIONV2LINKTYPE_RUNBOOK, + Url: "https://my-runbook", + }, + }, + Repos: []datadogV2.ServiceDefinitionV2Repo{ + { + Name: "Source Code", + Provider: datadog.PtrString("GitHub"), + Url: "https://github.com/DataDog/schema", + }, + }, + SchemaVersion: datadogV2.SERVICEDEFINITIONV2VERSION_V2, + Tags: []string{ + "my:tag", + "service:tag", + }, + Team: datadog.PtrString("my-team"), + }} + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewServiceDefinitionApi(apiClient) + resp, r, err := api.CreateOrUpdateServiceDefinitions(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServiceDefinitionApi.CreateOrUpdateServiceDefinitions`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ServiceDefinitionApi.CreateOrUpdateServiceDefinitions`:\n%s\n", responseContent) +} diff --git a/examples/v2/service-definition/DeleteServiceDefinition.go b/examples/v2/service-definition/DeleteServiceDefinition.go new file mode 100644 index 00000000000..968219471fd --- /dev/null +++ b/examples/v2/service-definition/DeleteServiceDefinition.go @@ -0,0 +1,25 @@ +// Delete a single service definition returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewServiceDefinitionApi(apiClient) + r, err := api.DeleteServiceDefinition(ctx, "service-Example-Delete_a_single_service_definition_returns_OK_response") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServiceDefinitionApi.DeleteServiceDefinition`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/service-definition/GetServiceDefinition.go b/examples/v2/service-definition/GetServiceDefinition.go new file mode 100644 index 00000000000..d95e2111273 --- /dev/null +++ b/examples/v2/service-definition/GetServiceDefinition.go @@ -0,0 +1,29 @@ +// Get a single service definition returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewServiceDefinitionApi(apiClient) + resp, r, err := api.GetServiceDefinition(ctx, "service-Example-Get_a_single_service_definition_returns_OK_response") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServiceDefinitionApi.GetServiceDefinition`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ServiceDefinitionApi.GetServiceDefinition`:\n%s\n", responseContent) +} diff --git a/examples/v2/service-definition/ListServiceDefinitions.go b/examples/v2/service-definition/ListServiceDefinitions.go new file mode 100644 index 00000000000..c85084bcf21 --- /dev/null +++ b/examples/v2/service-definition/ListServiceDefinitions.go @@ -0,0 +1,29 @@ +// Get all service definitions returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewServiceDefinitionApi(apiClient) + resp, r, err := api.ListServiceDefinitions(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServiceDefinitionApi.ListServiceDefinitions`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ServiceDefinitionApi.ListServiceDefinitions`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index e503b0f8a46..69f52323d58 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -64,6 +64,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "UsersApi": reflect.ValueOf(datadogV2.NewUsersApi), "ServiceAccountsApi": reflect.ValueOf(datadogV2.NewServiceAccountsApi), "IncidentServicesApi": reflect.ValueOf(datadogV2.NewIncidentServicesApi), + "ServiceDefinitionApi": reflect.ValueOf(datadogV2.NewServiceDefinitionApi), "IncidentTeamsApi": reflect.ValueOf(datadogV2.NewIncidentTeamsApi), "UsageMeteringApi": reflect.ValueOf(datadogV2.NewUsageMeteringApi), }, diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.freeze new file mode 100644 index 00000000000..73a4725426b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.freeze @@ -0,0 +1 @@ +2022-10-11T16:11:15.904Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.yaml new file mode 100644 index 00000000000..97c75cda9ce --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Create_or_update_service_definition_returns_CREATED_response.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: | + {"contacts":[{"contact":"contact@datadoghq.com","name":"Team Email","type":"email"}],"dd-service":"service-Test-Create_or_update_service_definition_returns_CREATED_response-1665504675","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mydoc"}],"extensions":{"myorgextension":"extensionvalue"},"integrations":{"opsgenie":{"region":"US","service-id":"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"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + url: https://api.datadoghq.com/api/v2/services/definitions + response: + body: '{"data":[{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-11T16:11:16.302119241Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[{"contact":"contact@datadoghq.com","type":"email","name":"Team + Email"}],"docs":[{"url":"https://gdrive/mydoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/schema","name":"Source + Code","provider":"GitHub"}],"tags":["my:tag","service:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"my-team","extensions":{},"dd-service":"service-test-create_or_update_service_definition_returns_created_response-1665504675"}},"type":"service-definition"}]} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + method: DELETE + url: https://api.datadoghq.com/api/v2/services/definitions/service-test-create_or_update_service_definition_returns_created_response-1665504675 + response: + body: '{"errors":["Not Found"],"error_details":[{}]} + + ' + code: 404 + duration: '' + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 1 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..ecf43ac5410 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2022-10-10T10:17:50.609Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..3d83511f6aa --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_Not_Found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + method: DELETE + url: https://api.datadoghq.com/api/v2/services/definitions/not-a-service + response: + body: '{"errors":["Not Found"],"error_details":[{}]} + + ' + code: 404 + duration: '' + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 1 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.freeze new file mode 100644 index 00000000000..7c200fe8888 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.freeze @@ -0,0 +1 @@ +2022-10-10T12:48:37.381Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.yaml new file mode 100644 index 00000000000..d1614f83a4d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Delete_a_single_service_definition_returns_OK_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"dd-service":"service-Test-Delete_a_single_service_definition_returns_OK_response-1665406117","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mygivedoc"}],"extensions":{"frogextension":"extensionfrogvalue"},"integrations":{"opsgenie":{"region":"US","service-id":"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/given"}],"schema-version":"v2","tags":["this:tag","service:tag"],"team":"super-team"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + url: https://api.datadoghq.com/api/v2/services/definitions + response: + body: '{"data":[{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:48:37.797458518Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["service:tag","this:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-delete_a_single_service_definition_returns_ok_response-1665406117"}},"type":"service-definition"}]} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + method: DELETE + url: https://api.datadoghq.com/api/v2/services/definitions/service-Test-Delete_a_single_service_definition_returns_OK_response-1665406117 + response: + body: '' + code: 204 + duration: '' + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + method: DELETE + url: https://api.datadoghq.com/api/v2/services/definitions/service-test-delete_a_single_service_definition_returns_ok_response-1665406117 + response: + body: '{"errors":["Not Found"],"error_details":[{}]} + + ' + code: 404 + duration: '' + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 1 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..8c5305630c8 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2022-10-10T10:18:53.337Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..147c4707c6d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_Not_Found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + method: GET + url: https://api.datadoghq.com/api/v2/services/definitions/not-a-service + response: + body: '{"errors":["Not Found"],"error_details":[{}]} + + ' + code: 404 + duration: '' + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 1 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.freeze new file mode 100644 index 00000000000..ebe71cdc853 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.freeze @@ -0,0 +1 @@ +2022-10-10T12:33:59.012Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.yaml new file mode 100644 index 00000000000..ec03ca9091b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"dd-service":"service-Test-Get_a_single_service_definition_returns_OK_response-1665405239","dd-team":"my-team","docs":[{"name":"Architecture","provider":"google drive","url":"https://gdrive/mygivedoc"}],"extensions":{"frogextension":"extensionfrogvalue"},"integrations":{"opsgenie":{"region":"US","service-id":"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/given"}],"schema-version":"v2","tags":["this:tag","service:tag"],"team":"super-team"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + url: https://api.datadoghq.com/api/v2/services/definitions + response: + body: '{"data":[{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:33:59.412229035Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["service:tag","this:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-get_a_single_service_definition_returns_ok_response-1665405239"}},"type":"service-definition"}]} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + method: GET + url: https://api.datadoghq.com/api/v2/services/definitions/service-Test-Get_a_single_service_definition_returns_OK_response-1665405239 + response: + body: '{"data":{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:24:16Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["service:tag","this:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-get_a_single_service_definition_returns_ok_response-1665405239"}},"type":"service-definition","id":"d6822c235d26b96b47ded1a3eecba6c1"}}' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 Not Found +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + method: DELETE + url: https://api.datadoghq.com/api/v2/services/definitions/service-test-get_a_single_service_definition_returns_ok_response-1665405239 + response: + body: '{"errors":["Not Found"],"error_details":[{}]} + + ' + code: 404 + duration: '' + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 1 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.freeze new file mode 100644 index 00000000000..5a0a49b3223 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.freeze @@ -0,0 +1 @@ +2022-10-10T12:54:43.916Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.yaml new file mode 100644 index 00000000000..7beab075560 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.yaml @@ -0,0 +1,372 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + method: GET + url: https://api.datadoghq.com/api/v2/services/definitions + response: + body: '{"data":[{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-13T15:05:42Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"test-service"}},"type":"service-definition","id":"00c8f48f9bd65a7326d109c110903a48"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-24T12:26:31Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664022388"}},"type":"service-definition","id":"0b92287408533dc9010ece79b9b7f5da"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-23T12:27:52Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663936069"}},"type":"service-definition","id":"1121978c2d509695d6b308699ad4ff3c"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-08T00:35:29Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665189327"}},"type":"service-definition","id":"11c76361fe9a02282257f8281c3a7e84"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:48:37Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["this:tag","service:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-delete_a_single_service_definition_returns_ok_response-1665406117"}},"type":"service-definition","id":"142c3ef445627d2db24dc2efe071feaf"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-17T00:37:54Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663375071"}},"type":"service-definition","id":"15dac466909d300907b2cb5c23d43034"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-19T20:35:44Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663619739-updated"}},"type":"service-definition","id":"193e0a13e3f5e898ce9a83bd06b390a5"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T00:34:27Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665362065"}},"type":"service-definition","id":"1eb456f17841bcead8624eb76c3dce31"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-26T00:35:13Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664152511"}},"type":"service-definition","id":"2cc3a1ebf7c90790ae7f58d4fe90152f"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-28T16:03:10Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664380988"}},"type":"service-definition","id":"2dc81e8abea92a4cd9a604ece099a953"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:14:45Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665404081"}},"type":"service-definition","id":"31f1337cc68728878aab22845fbc9e8b"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-20T12:19:04Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663676342"}},"type":"service-definition","id":"3227cd18de3a45aa88f01143cc20d58e"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-08-04T20:17:04Z","github-html-url":"","warnings":[]},"schema":{"links":[],"contacts":[],"docs":[],"repos":[],"tags":["host:isolated-diego-cell-0-270372e1-a8ae-4d3c-9678-41a072dd365c"],"dd-team":"intg-tools-libs","integrations":{},"schema-version":"v2","team":"intg-tools-libs","extensions":{},"dd-service":"python-sample-app-unbleachedsilk"}},"type":"service-definition","id":"3452c51e0db6322b8cd3290d06540978"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-18T12:17:13Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663503431"}},"type":"service-definition","id":"37636efa41bc8106beb35ccb2048e67d"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:33:59Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["service:tag","this:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-get_a_single_service_definition_returns_ok_response-1665405239"}},"type":"service-definition","id":"3f712fd0846e734cf273d8bf10aba358"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-04T12:23:57Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664886235"}},"type":"service-definition","id":"44b348df99fb628eba7da07aa9c1f08a"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-15T00:32:57Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663201975"}},"type":"service-definition","id":"47c27bd6f1fc510941849e27cc87a50a"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-17T12:37:04Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663418218-updated"}},"type":"service-definition","id":"49485bc9760c67bd934a76b3769c6bf3"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-28T15:14:44Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664378080-updated"}},"type":"service-definition","id":"4983a2094fbed9a7426fa952b238e56a"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T00:24:50Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665361489"}},"type":"service-definition","id":"4c895f6110be70e6957f12e3f8e5a62d"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-17T00:29:11Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663374546-updated"}},"type":"service-definition","id":"4dc2beec923d8095338f6534979d652d"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-23T12:27:04Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663936022"}},"type":"service-definition","id":"5a1ce48c269f2c227f48ec0a5eeffae2"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-24T00:39:13Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663979951"}},"type":"service-definition","id":"5ddd66188cbbd5f857a86e3cd3c567d7"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-08T00:35:01Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665189299"}},"type":"service-definition","id":"5e90ebc923829a1f089305fa612dc842"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-29T00:31:52Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664411510"}},"type":"service-definition","id":"5e981473bd66799cdbfdab5667699d21"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-24T00:39:55Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663979992"}},"type":"service-definition","id":"6191014cb0d8f2a8a72a2f0acca8c35f"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-28T14:31:34Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664375492"}},"type":"service-definition","id":"654f80015adf24d97e59ffcb2a46e678"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-23T12:23:23Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663935801"}},"type":"service-definition","id":"690d77bf33bb43c1b40157eb1455fe97"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-15T00:32:32Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663201951"}},"type":"service-definition","id":"6a7a9a2a95b392e21466173f83868da1"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-17T12:36:53Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663418211"}},"type":"service-definition","id":"6ae98d51f75fab86e96d6cc9efd02123"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-09T12:13:57Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665317635"}},"type":"service-definition","id":"78031c2a631318e7f2cb7bfbf68a18be"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-25T00:36:39Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664066196"}},"type":"service-definition","id":"82da2d6ea18971b06c81c55b36edd03d"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-16T00:34:30Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663288468"}},"type":"service-definition","id":"85b18f281ff2c3d794195d4e5e3703de"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-17T12:21:03Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663417258"}},"type":"service-definition","id":"866a88946ed335a8f3de72a9617fa39d"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T10:29:06Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["this:tag","service:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-get_a_single_service_definition_returns_ok_response-1665397746"}},"type":"service-definition","id":"8b2110b5ac6ad3b8ced03af62700f96a"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-20T12:31:41Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663677098"}},"type":"service-definition","id":"8ba17884f966f9cc42355051bc45fe15"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-18T00:36:38Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663461397"}},"type":"service-definition","id":"96399afc130bc415a0f555d5a81c7591"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-22T12:27:47Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663849665"}},"type":"service-definition","id":"9b02212ffcf45156efa8254441343b65"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-08T00:25:24Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665188722"}},"type":"service-definition","id":"9cd2939b2ccad303a5faf906329bdddd"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-24T12:26:46Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664022404"}},"type":"service-definition","id":"a2af7651d982e91ab5305665b967e7ff"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-05T12:15:01Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664972099"}},"type":"service-definition","id":"a91a2011287371e9bc78e8440dfd6d30"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-24T00:40:33Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663980031"}},"type":"service-definition","id":"b283555a3adcbc6e7ee662fca6c9c815"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-18T00:25:46Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663460745"}},"type":"service-definition","id":"b7c93e14a001dec8f48c54ac46ee52ff"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-19T12:18:01Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663589879"}},"type":"service-definition","id":"bb70888ec662b81ec18623b586b34c72"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-24T12:23:19Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664022198"}},"type":"service-definition","id":"bea5986b81a67b3a06f74db75753cbf6"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-20T12:31:30Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663677087"}},"type":"service-definition","id":"c5187921f635b5679171150e3c497518"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-22T12:27:21Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663849639"}},"type":"service-definition","id":"c5a73fff1eeb3082dedf1015bf5eb8c7"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-01T12:15:40Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664626538"}},"type":"service-definition","id":"c887ca10d1ffc5d9a939c68f38d84e25"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-07T12:15:14Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665144911"}},"type":"service-definition","id":"cc016d2b21fad7b7af073a6fcf8f70b6"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-15T00:33:02Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663201980"}},"type":"service-definition","id":"cc2af89492dc572929a72b2705142aa2"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-09T12:24:43Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665318281"}},"type":"service-definition","id":"d4d04320f1daf9db2e3ff75de377edaa"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T12:24:16Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://my-runbook","type":"runbook","name":"Runbook"}],"contacts":[],"docs":[{"url":"https://gdrive/mygivedoc","name":"Architecture","provider":"google + drive"}],"repos":[{"url":"https://github.com/DataDog/given","name":"Source Code","provider":"GitHub"}],"tags":["this:tag","service:tag"],"dd-team":"my-team","integrations":{"opsgenie":{"region":"US","service-id":"123e4567-e89b-12d3-a456-426614174000"},"pagerduty":"https://my-org.pagerduty.com/service-directory/PMyService"},"schema-version":"v2","team":"super-team","extensions":{},"dd-service":"service-test-get_a_single_service_definition_returns_ok_response-1665404656"}},"type":"service-definition","id":"d6822c235d26b96b47ded1a3eecba6c1"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-06T12:23:44Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665059022"}},"type":"service-definition","id":"dbe6ec9de10888c6d333539aecdf962a"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-08T12:15:17Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665231315"}},"type":"service-definition","id":"e148aa733e21ac31994b1e26a789c418"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-25T00:41:11Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664066464-updated"}},"type":"service-definition","id":"e20df46b4b1b3c34eee0db47f7cdaa1f"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-09T12:25:03Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665318301"}},"type":"service-definition","id":"e49200dcf5868c0e0f06249986f37446"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-18T00:36:33Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663461391"}},"type":"service-definition","id":"e5745cc928c0887bdb6b63d9649636c9"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-26T00:38:33Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664152711"}},"type":"service-definition","id":"ea7e4590c85ff751a03d3e957396c3ba"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-08-04T20:37:09Z","github-html-url":"","warnings":[]},"schema":{"links":[],"contacts":[{"contact":"noueman.khalikine@datadoghq.com","type":"email"}],"docs":[],"repos":[],"tags":[],"dd-team":"intg-tools-libs","integrations":{},"schema-version":"v2","team":"intg-tools-libs","extensions":{},"dd-service":"python-app-checks-enabled"}},"type":"service-definition","id":"edbfdd906e141e7512918fa561c7e90d"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-05T12:25:35Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664972730-updated"}},"type":"service-definition","id":"f031b34f679003f9eaff0cd02324a42e"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-28T16:02:54Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664380972"}},"type":"service-definition","id":"f4a723cbeccb6827f12849a358fbfc3a"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-22T12:23:52Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1663849431"}},"type":"service-definition","id":"f5d046880a32d46aa4f0a05e8a6dd5f8"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-09-26T00:38:27Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["business-unit:retail","cost-center:engineering"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1664152705"}},"type":"service-definition","id":"fa1f962ad5fbc7655d080ac2a7010065"},{"attributes":{"meta":{"ingested-schema-version":"v2","ingestion-source":"api","last-modified-time":"2022-10-10T00:34:05Z","github-html-url":"","warnings":[]},"schema":{"links":[{"url":"https://runbook/shopping-cart","type":"runbook","name":"shopping-cart + runbook"}],"contacts":[{"contact":"https://www.slack.com/archives/shopping-cart","type":"slack","name":"Support + Slack"},{"contact":"team@shopping.com","type":"email","name":"Support Email"}],"docs":[{"url":"https://google.drive/shopping-cart-architecture","name":"shopping-cart + architecture","provider":"gdoc"},{"url":"https://wiki/shopping-cart","name":"shopping-cart + service Wiki","provider":"wiki"}],"repos":[{"url":"http://github/shopping-cart","name":"shopping-cart + source code","provider":"github"}],"tags":["cost-center:engineering","business-unit:retail"],"dd-team":"e-commerce","integrations":{"pagerduty":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"schema-version":"v2","team":"E + Commerce","extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"dd-service":"tf-testaccdatadogservicedefinition_basic-local-1665362043"}},"type":"service-definition","id":"fd7673ad83bc150e2d690fc8c9196f41"}]} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +version: 1 diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index ae5daeae699..4b4f179d184 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -286,6 +286,18 @@ "tag": "Incident Services", "operationId": "CreateIncidentService" }, + { + "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-id\": \"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", + "key": "service_definition", + "tag": "Service Definition", + "operationId": "CreateOrUpdateServiceDefinitions" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/service_definition.feature b/tests/scenarios/features/v2/service_definition.feature new file mode 100644 index 00000000000..ce38544c400 --- /dev/null +++ b/tests/scenarios/features/v2/service_definition.feature @@ -0,0 +1,91 @@ +@endpoint(service-definition) @endpoint(service-definition-v2) +Feature: Service Definition + API to create, update, retrieve and delete service definitions. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ServiceDefinition" API + + @generated @skip @team:DataDog/apm-insights + 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-id": "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 400 Bad Request + + @team:DataDog/apm-insights + 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-id": "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" + + @generated @skip @team:DataDog/apm-insights + 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-id": "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 409 Conflict + + @generated @skip @team:DataDog/apm-insights + 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 + 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" + When the request is sent + Then the response status is 404 Not Found + And the response "errors[0]" is equal to "Not Found" + + @replay-only @team:DataDog/apm-insights + Scenario: Delete a single service definition returns "OK" response + Given there is a valid "service_definition" in the system + And new "DeleteServiceDefinition" request + And request contains "service_name" parameter with value "service-{{ unique }}" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/apm-insights + 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 + 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 + 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" + When the request is sent + Then the response status is 404 Not Found + And the response "errors[0]" is equal to "Not Found" + + @replay-only @team:DataDog/apm-insights + Scenario: Get a single service definition returns "OK" response + Given there is a valid "service_definition" in the system + And new "GetServiceDefinition" request + And request contains "service_name" parameter with value "service-{{ unique }}" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.meta.ingested-schema-version" is equal to "v2" + + @team:DataDog/apm-insights + Scenario: Get all service definitions returns "OK" response + Given new "ListServiceDefinitions" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.meta.ingested-schema-version" is equal to "v2" diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 80a6729cdff..fef02ce33c9 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -867,6 +867,37 @@ "type": "unsafe" } }, + "ListServiceDefinitions": { + "tag": "Service Definition", + "undo": { + "type": "safe" + } + }, + "CreateOrUpdateServiceDefinitions": { + "tag": "Service Definition", + "undo": { + "operationId": "DeleteServiceDefinition", + "parameters": [ + { + "name": "service_name", + "source": "data[0].attributes.schema.dd-service" + } + ], + "type": "unsafe" + } + }, + "DeleteServiceDefinition": { + "tag": "Service Definition", + "undo": { + "type": "idempotent" + } + }, + "GetServiceDefinition": { + "tag": "Service Definition", + "undo": { + "type": "safe" + } + }, "DeleteIncidentService": { "tag": "Incident Services", "undo": { diff --git a/tests/scenarios/step_definitions.go b/tests/scenarios/step_definitions.go index 051e87f5e86..6771be8af22 100644 --- a/tests/scenarios/step_definitions.go +++ b/tests/scenarios/step_definitions.go @@ -209,7 +209,7 @@ func requestIsSent(t gobdd.StepTest, ctx gobdd.Context) { ctx.Set(responseKey{}, result) // Report probable serialization errors - if len(result) > 2 { + if len(result) > 1 { resp := result[len(result)-2].Interface().(*http.Response) if resp == nil { return @@ -234,7 +234,7 @@ func requestIsSent(t gobdd.StepTest, ctx gobdd.Context) { if newErr := json.Unmarshal(err.Body(), &responseJSON); newErr != nil { responseJSON = string(err.Body()) } - } else { + } else if len(result) == 3 { // Store the unmarshalled JSON in context responseJSON, err = toJSON(result[0]) if err != nil {