Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add componentOf field to Service, Queue, and Datastore V3 Software Catalog definitions #3003

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "2025-04-02 19:55:32.383429",
"spec_repo_commit": "1cc45c45"
"regenerated": "2025-04-02 20:49:30.283371",
"spec_repo_commit": "9ea284b5"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-04-02 19:55:32.399089",
"spec_repo_commit": "1cc45c45"
"regenerated": "2025-04-02 20:49:30.298853",
"spec_repo_commit": "9ea284b5"
}
}
}
15 changes: 15 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12431,6 +12431,11 @@ components:
additionalProperties: false
description: The definition of Entity V3 Datastore Spec object.
properties:
componentOf:
description: A list of components the datastore is a part of
items:
type: string
type: array
lifecycle:
description: The lifecycle state of the datastore.
minLength: 1
Expand Down Expand Up @@ -12629,6 +12634,11 @@ components:
additionalProperties: false
description: The definition of Entity V3 Queue Spec object.
properties:
componentOf:
description: A list of components the queue is a part of
items:
type: string
type: array
lifecycle:
description: The lifecycle state of the queue.
minLength: 1
Expand Down Expand Up @@ -12694,6 +12704,11 @@ components:
additionalProperties: false
description: The definition of Entity V3 Service Spec object.
properties:
componentOf:
description: A list of components the service is a part of
items:
type: string
type: array
dependsOn:
description: A list of components the service depends on.
items:
Expand Down
41 changes: 38 additions & 3 deletions api/datadogV2/model_entity_v3_datastore_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

// EntityV3DatastoreSpec The definition of Entity V3 Datastore Spec object.
type EntityV3DatastoreSpec struct {
// A list of components the datastore is a part of
ComponentOf []string `json:"componentOf,omitempty"`
// The lifecycle state of the datastore.
Lifecycle *string `json:"lifecycle,omitempty"`
// The importance of the datastore.
Expand Down Expand Up @@ -37,6 +39,34 @@ func NewEntityV3DatastoreSpecWithDefaults() *EntityV3DatastoreSpec {
return &this
}

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

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

// HasComponentOf returns a boolean if a field has been set.
func (o *EntityV3DatastoreSpec) HasComponentOf() bool {
return o != nil && o.ComponentOf != nil
}

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

// GetLifecycle returns the Lifecycle field value if set, zero value otherwise.
func (o *EntityV3DatastoreSpec) GetLifecycle() string {
if o == nil || o.Lifecycle == nil {
Expand Down Expand Up @@ -127,6 +157,9 @@ func (o EntityV3DatastoreSpec) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.ComponentOf != nil {
toSerialize["componentOf"] = o.ComponentOf
}
if o.Lifecycle != nil {
toSerialize["lifecycle"] = o.Lifecycle
}
Expand All @@ -142,13 +175,15 @@ func (o EntityV3DatastoreSpec) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *EntityV3DatastoreSpec) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Lifecycle *string `json:"lifecycle,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *string `json:"type,omitempty"`
ComponentOf []string `json:"componentOf,omitempty"`
Lifecycle *string `json:"lifecycle,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *string `json:"type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
o.ComponentOf = all.ComponentOf
o.Lifecycle = all.Lifecycle
o.Tier = all.Tier
o.Type = all.Type
Expand Down
41 changes: 38 additions & 3 deletions api/datadogV2/model_entity_v3_queue_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

// EntityV3QueueSpec The definition of Entity V3 Queue Spec object.
type EntityV3QueueSpec struct {
// A list of components the queue is a part of
ComponentOf []string `json:"componentOf,omitempty"`
// The lifecycle state of the queue.
Lifecycle *string `json:"lifecycle,omitempty"`
// The importance of the queue.
Expand Down Expand Up @@ -37,6 +39,34 @@ func NewEntityV3QueueSpecWithDefaults() *EntityV3QueueSpec {
return &this
}

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

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

// HasComponentOf returns a boolean if a field has been set.
func (o *EntityV3QueueSpec) HasComponentOf() bool {
return o != nil && o.ComponentOf != nil
}

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

// GetLifecycle returns the Lifecycle field value if set, zero value otherwise.
func (o *EntityV3QueueSpec) GetLifecycle() string {
if o == nil || o.Lifecycle == nil {
Expand Down Expand Up @@ -127,6 +157,9 @@ func (o EntityV3QueueSpec) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.ComponentOf != nil {
toSerialize["componentOf"] = o.ComponentOf
}
if o.Lifecycle != nil {
toSerialize["lifecycle"] = o.Lifecycle
}
Expand All @@ -142,13 +175,15 @@ func (o EntityV3QueueSpec) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *EntityV3QueueSpec) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Lifecycle *string `json:"lifecycle,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *string `json:"type,omitempty"`
ComponentOf []string `json:"componentOf,omitempty"`
Lifecycle *string `json:"lifecycle,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *string `json:"type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
o.ComponentOf = all.ComponentOf
o.Lifecycle = all.Lifecycle
o.Tier = all.Tier
o.Type = all.Type
Expand Down
45 changes: 40 additions & 5 deletions api/datadogV2/model_entity_v3_service_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

// EntityV3ServiceSpec The definition of Entity V3 Service Spec object.
type EntityV3ServiceSpec struct {
// A list of components the service is a part of
ComponentOf []string `json:"componentOf,omitempty"`
// A list of components the service depends on.
DependsOn []string `json:"dependsOn,omitempty"`
// The service's programming language.
Expand Down Expand Up @@ -41,6 +43,34 @@ func NewEntityV3ServiceSpecWithDefaults() *EntityV3ServiceSpec {
return &this
}

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

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

// HasComponentOf returns a boolean if a field has been set.
func (o *EntityV3ServiceSpec) HasComponentOf() bool {
return o != nil && o.ComponentOf != nil
}

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

// GetDependsOn returns the DependsOn field value if set, zero value otherwise.
func (o *EntityV3ServiceSpec) GetDependsOn() []string {
if o == nil || o.DependsOn == nil {
Expand Down Expand Up @@ -187,6 +217,9 @@ func (o EntityV3ServiceSpec) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.ComponentOf != nil {
toSerialize["componentOf"] = o.ComponentOf
}
if o.DependsOn != nil {
toSerialize["dependsOn"] = o.DependsOn
}
Expand All @@ -208,15 +241,17 @@ func (o EntityV3ServiceSpec) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *EntityV3ServiceSpec) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
DependsOn []string `json:"dependsOn,omitempty"`
Languages []string `json:"languages,omitempty"`
Lifecycle *string `json:"lifecycle,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *string `json:"type,omitempty"`
ComponentOf []string `json:"componentOf,omitempty"`
DependsOn []string `json:"dependsOn,omitempty"`
Languages []string `json:"languages,omitempty"`
Lifecycle *string `json:"lifecycle,omitempty"`
Tier *string `json:"tier,omitempty"`
Type *string `json:"type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
o.ComponentOf = all.ComponentOf
o.DependsOn = all.DependsOn
o.Languages = all.Languages
o.Lifecycle = all.Lifecycle
Expand Down
5 changes: 3 additions & 2 deletions examples/v2/software-catalog/UpsertCatalogEntity.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ func main() {
},
},
Spec: &datadogV2.EntityV3ServiceSpec{
DependsOn: []string{},
Languages: []string{},
ComponentOf: []string{},
DependsOn: []string{},
Languages: []string{},
},
}}}
ctx := datadog.NewDefaultContext(context.Background())
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/features/v2/software_catalog.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Feature: Software Catalog
@generated @skip @team:DataDog/service-catalog
Scenario: Create or update entities returns "ACCEPTED" response
Given new "UpsertCatalogEntity" request
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"componentOf": [], "dependsOn": [], "languages": []}}
When the request is sent
Then the response status is 202 ACCEPTED

@generated @skip @team:DataDog/service-catalog
Scenario: Create or update entities returns "Bad Request" response
Given new "UpsertCatalogEntity" request
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"componentOf": [], "dependsOn": [], "languages": []}}
When the request is sent
Then the response status is 400 Bad Request

Expand Down