Skip to content

Commit

Permalink
Add ci-pipeline-fingerprints field in v2.2 (#2432)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Mar 14, 2024
1 parent 5ad8b96 commit 44388b3
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-03-13 19:22:41.663835",
"spec_repo_commit": "5745e5bb"
"regenerated": "2024-03-14 19:01:49.867187",
"spec_repo_commit": "0197a1bb"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-03-13 19:22:41.682205",
"spec_repo_commit": "5745e5bb"
"regenerated": "2024-03-14 19:01:49.885000",
"spec_repo_commit": "0197a1bb"
}
}
}
8 changes: 8 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19683,6 +19683,14 @@ components:
feature, which the service is a part of.
example: my-app
type: string
ci-pipeline-fingerprints:
description: A set of CI fingerprints.
example:
- j88xdEy0J5lc
- eZ7LMljCk8vo
items:
type: string
type: array
contacts:
description: A list of contacts related to the services.
items:
Expand Down
65 changes: 50 additions & 15 deletions api/datadogV2/model_service_definition_v2_dot2.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
type ServiceDefinitionV2Dot2 struct {
// Identifier for a group of related services serving a product feature, which the service is a part of.
Application *string `json:"application,omitempty"`
// A set of CI fingerprints.
CiPipelineFingerprints []string `json:"ci-pipeline-fingerprints,omitempty"`
// A list of contacts related to the services.
Contacts []ServiceDefinitionV2Dot2Contact `json:"contacts,omitempty"`
// Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.
Expand Down Expand Up @@ -94,6 +96,34 @@ func (o *ServiceDefinitionV2Dot2) SetApplication(v string) {
o.Application = &v
}

// GetCiPipelineFingerprints returns the CiPipelineFingerprints field value if set, zero value otherwise.
func (o *ServiceDefinitionV2Dot2) GetCiPipelineFingerprints() []string {
if o == nil || o.CiPipelineFingerprints == nil {
var ret []string
return ret
}
return o.CiPipelineFingerprints
}

// GetCiPipelineFingerprintsOk returns a tuple with the CiPipelineFingerprints field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ServiceDefinitionV2Dot2) GetCiPipelineFingerprintsOk() (*[]string, bool) {
if o == nil || o.CiPipelineFingerprints == nil {
return nil, false
}
return &o.CiPipelineFingerprints, true
}

// HasCiPipelineFingerprints returns a boolean if a field has been set.
func (o *ServiceDefinitionV2Dot2) HasCiPipelineFingerprints() bool {
return o != nil && o.CiPipelineFingerprints != nil
}

// SetCiPipelineFingerprints gets a reference to the given []string and assigns it to the CiPipelineFingerprints field.
func (o *ServiceDefinitionV2Dot2) SetCiPipelineFingerprints(v []string) {
o.CiPipelineFingerprints = v
}

// GetContacts returns the Contacts field value if set, zero value otherwise.
func (o *ServiceDefinitionV2Dot2) GetContacts() []ServiceDefinitionV2Dot2Contact {
if o == nil || o.Contacts == nil {
Expand Down Expand Up @@ -457,6 +487,9 @@ func (o ServiceDefinitionV2Dot2) MarshalJSON() ([]byte, error) {
if o.Application != nil {
toSerialize["application"] = o.Application
}
if o.CiPipelineFingerprints != nil {
toSerialize["ci-pipeline-fingerprints"] = o.CiPipelineFingerprints
}
if o.Contacts != nil {
toSerialize["contacts"] = o.Contacts
}
Expand Down Expand Up @@ -502,20 +535,21 @@ func (o ServiceDefinitionV2Dot2) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *ServiceDefinitionV2Dot2) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Application *string `json:"application,omitempty"`
Contacts []ServiceDefinitionV2Dot2Contact `json:"contacts,omitempty"`
DdService *string `json:"dd-service"`
Description *string `json:"description,omitempty"`
Extensions map[string]interface{} `json:"extensions,omitempty"`
Integrations *ServiceDefinitionV2Dot2Integrations `json:"integrations,omitempty"`
Languages []string `json:"languages,omitempty"`
Lifecycle *string `json:"lifecycle,omitempty"`
Links []ServiceDefinitionV2Dot2Link `json:"links,omitempty"`
SchemaVersion *ServiceDefinitionV2Dot2Version `json:"schema-version"`
Tags []string `json:"tags,omitempty"`
Team *string `json:"team,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *ServiceDefinitionV2Dot2Type `json:"type,omitempty"`
Application *string `json:"application,omitempty"`
CiPipelineFingerprints []string `json:"ci-pipeline-fingerprints,omitempty"`
Contacts []ServiceDefinitionV2Dot2Contact `json:"contacts,omitempty"`
DdService *string `json:"dd-service"`
Description *string `json:"description,omitempty"`
Extensions map[string]interface{} `json:"extensions,omitempty"`
Integrations *ServiceDefinitionV2Dot2Integrations `json:"integrations,omitempty"`
Languages []string `json:"languages,omitempty"`
Lifecycle *string `json:"lifecycle,omitempty"`
Links []ServiceDefinitionV2Dot2Link `json:"links,omitempty"`
SchemaVersion *ServiceDefinitionV2Dot2Version `json:"schema-version"`
Tags []string `json:"tags,omitempty"`
Team *string `json:"team,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *ServiceDefinitionV2Dot2Type `json:"type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand All @@ -528,13 +562,14 @@ func (o *ServiceDefinitionV2Dot2) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"application", "contacts", "dd-service", "description", "extensions", "integrations", "languages", "lifecycle", "links", "schema-version", "tags", "team", "tier", "type"})
datadog.DeleteKeys(additionalProperties, &[]string{"application", "ci-pipeline-fingerprints", "contacts", "dd-service", "description", "extensions", "integrations", "languages", "lifecycle", "links", "schema-version", "tags", "team", "tier", "type"})
} else {
return err
}

hasInvalidField := false
o.Application = all.Application
o.CiPipelineFingerprints = all.CiPipelineFingerprints
o.Contacts = all.Contacts
o.DdService = *all.DdService
o.Description = all.Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func main() {
body := datadogV2.ServiceDefinitionsCreateRequest{
ServiceDefinitionV2Dot2: &datadogV2.ServiceDefinitionV2Dot2{
Application: datadog.PtrString("my-app"),
CiPipelineFingerprints: []string{
"j88xdEy0J5lc",
"eZ7LMljCk8vo",
},
Contacts: []datadogV2.ServiceDefinitionV2Dot2Contact{
{
Contact: "https://teams.microsoft.com/myteam",
Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/features/v2/service_definition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ Feature: Service Definition
@generated @skip @team:DataDog/service-catalog
Scenario: Create or update service definition returns "Bad Request" response
Given new "CreateOrUpdateServiceDefinitions" request
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "languages": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
And body with value {"application": "my-app", "ci-pipeline-fingerprints": ["j88xdEy0J5lc", "eZ7LMljCk8vo"], "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "languages": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/service-catalog
Scenario: Create or update service definition returns "CREATED" response
Given new "CreateOrUpdateServiceDefinitions" request
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "languages": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
And body with value {"application": "my-app", "ci-pipeline-fingerprints": ["j88xdEy0J5lc", "eZ7LMljCk8vo"], "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "languages": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
When the request is sent
Then the response status is 200 CREATED

@generated @skip @team:DataDog/service-catalog
Scenario: Create or update service definition returns "Conflict" response
Given new "CreateOrUpdateServiceDefinitions" request
And body with value {"application": "my-app", "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "languages": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
And body with value {"application": "my-app", "ci-pipeline-fingerprints": ["j88xdEy0J5lc", "eZ7LMljCk8vo"], "contacts": [{"contact": "https://teams.microsoft.com/myteam", "name": "My team channel", "type": "slack"}], "dd-service": "my-service", "description": "My service description", "extensions": {"myorg/extension": "extensionValue"}, "integrations": {"opsgenie": {"region": "US", "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"}, "pagerduty": {"service-url": "https://my-org.pagerduty.com/service-directory/PMyService"}}, "languages": ["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"], "lifecycle": "sandbox", "links": [{"name": "Runbook", "provider": "Github", "type": "runbook", "url": "https://my-runbook"}], "schema-version": "v2.2", "tags": ["my:tag", "service:tag"], "team": "my-team", "tier": "High", "type": "web"}
When the request is sent
Then the response status is 409 Conflict

Expand Down

0 comments on commit 44388b3

Please sign in to comment.