Skip to content
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
3 changes: 3 additions & 0 deletions .changes/unreleased/Feature-20251211-145211.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Feature
body: Add support for owner relationships & component category predicates
time: 2025-12-11T14:52:11.411595-05:00
28 changes: 26 additions & 2 deletions component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@ func TestComponentTypeCreate(t *testing.T) {
Name: ol.RefOf("Example"),
Description: ol.RefOf("Example Description"),
Properties: &[]ol.ComponentTypePropertyDefinitionInput{},
OwnerRelationship: &ol.OwnerRelationshipInput{
ManagementRules: &[]ol.ManagementRuleInput{
{
Operator: ol.RelationshipDefinitionManagementRuleOperatorEquals,
SourceProperty: "tag_key_eq:owner",
SourcePropertyBuiltin: true,
TargetProperty: "name",
TargetPropertyBuiltin: true,
TargetType: ol.NewNullableFrom("team"),
},
},
},
})

testRequest := autopilot.NewTestRequest(
`mutation ComponentTypeCreate($input:ComponentTypeInput!){componentTypeCreate(input:$input){componentType{{ template "component_type_graphql" }},errors{message,path}}}`,
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": []} }`,
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": [], "ownerRelationship": {"managementRules": [{"operator": "EQUALS", "sourceProperty": "tag_key_eq:owner", "sourcePropertyBuiltin": true, "targetProperty": "name", "targetPropertyBuiltin": true, "targetType": "team"}]} }}`,
`{"data": {"componentTypeCreate": {"componentType": {{ template "component_type_1_response" }} }}}`,
)

Expand Down Expand Up @@ -81,11 +93,23 @@ func TestComponentTypeUpdate(t *testing.T) {
Name: ol.RefOf("Example"),
Description: ol.RefOf("Example Description"),
Properties: &[]ol.ComponentTypePropertyDefinitionInput{},
OwnerRelationship: &ol.OwnerRelationshipInput{
ManagementRules: &[]ol.ManagementRuleInput{
{
Operator: ol.RelationshipDefinitionManagementRuleOperatorEquals,
SourceProperty: "tag_key_eq:owner",
SourcePropertyBuiltin: true,
TargetProperty: "name",
TargetPropertyBuiltin: true,
TargetType: ol.NewNullableFrom("team"),
},
},
},
})

testRequest := autopilot.NewTestRequest(
`mutation ComponentTypeUpdate($input:ComponentTypeInput!$target:IdentifierInput!){componentTypeUpdate(componentType:$target,input:$input){componentType{{ template "component_type_graphql" }},errors{message,path}}}`,
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": []}, "target": { {{ template "id1" }} }}`,
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": [], "ownerRelationship": {"managementRules": [{"operator": "EQUALS", "sourceProperty": "tag_key_eq:owner", "sourcePropertyBuiltin": true, "targetProperty": "name", "targetPropertyBuiltin": true, "targetType": "team"}]}}, "target": { {{ template "id1" }} }}`,
`{"data": {"componentTypeUpdate": {"componentType": {{ template "component_type_1_response" }} }}}`,
)

Expand Down
52 changes: 21 additions & 31 deletions enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -2859,30 +2859,32 @@ var AllPayloadSortEnum = []string{
type PredicateKeyEnum string

var (
PredicateKeyEnumAliases PredicateKeyEnum = "aliases" // Filter by Alias attached to this service, if any
PredicateKeyEnumComponentTypeID PredicateKeyEnum = "component_type_id" // Filter by the `component_type` field
PredicateKeyEnumCreationSource PredicateKeyEnum = "creation_source" // Filter by the creation source
PredicateKeyEnumDomainID PredicateKeyEnum = "domain_id" // Filter by Domain that includes the System this service is assigned to, if any
PredicateKeyEnumFilterID PredicateKeyEnum = "filter_id" // Filter by another filter
PredicateKeyEnumFramework PredicateKeyEnum = "framework" // Filter by `framework` field
PredicateKeyEnumGroupIDs PredicateKeyEnum = "group_ids" // Filter by group hierarchy. Will return resources who's owner is in the group ancestry chain
PredicateKeyEnumLanguage PredicateKeyEnum = "language" // Filter by `language` field
PredicateKeyEnumLifecycleIndex PredicateKeyEnum = "lifecycle_index" // Filter by `lifecycle` field
PredicateKeyEnumName PredicateKeyEnum = "name" // Filter by `name` field
PredicateKeyEnumOwnerID PredicateKeyEnum = "owner_id" // Filter by `owner` field
PredicateKeyEnumOwnerIDs PredicateKeyEnum = "owner_ids" // Filter by `owner` hierarchy. Will return resources who's owner is in the team ancestry chain
PredicateKeyEnumProduct PredicateKeyEnum = "product" // Filter by `product` field
PredicateKeyEnumProperties PredicateKeyEnum = "properties" // Filter by custom-defined properties
PredicateKeyEnumRelationships PredicateKeyEnum = "relationships" // Filter by `relationships`
PredicateKeyEnumRepositoryIDs PredicateKeyEnum = "repository_ids" // Filter by Repository that this service is attached to, if any
PredicateKeyEnumSystemID PredicateKeyEnum = "system_id" // Filter by System that this service is assigned to, if any
PredicateKeyEnumTags PredicateKeyEnum = "tags" // Filter by `tags` field
PredicateKeyEnumTierIndex PredicateKeyEnum = "tier_index" // Filter by `tier` field
PredicateKeyEnumAliases PredicateKeyEnum = "aliases" // Filter by Alias attached to this service, if any
PredicateKeyEnumComponentCategory PredicateKeyEnum = "component_category" // Filter by the component type category for this service
PredicateKeyEnumComponentTypeID PredicateKeyEnum = "component_type_id" // Filter by the `component_type` field
PredicateKeyEnumCreationSource PredicateKeyEnum = "creation_source" // Filter by the creation source
PredicateKeyEnumDomainID PredicateKeyEnum = "domain_id" // Filter by Domain that includes the System this service is assigned to, if any
PredicateKeyEnumFilterID PredicateKeyEnum = "filter_id" // Filter by another filter
PredicateKeyEnumFramework PredicateKeyEnum = "framework" // Filter by `framework` field
PredicateKeyEnumGroupIDs PredicateKeyEnum = "group_ids" // Filter by group hierarchy. Will return resources who's owner is in the group ancestry chain
PredicateKeyEnumLanguage PredicateKeyEnum = "language" // Filter by `language` field
PredicateKeyEnumLifecycleIndex PredicateKeyEnum = "lifecycle_index" // Filter by `lifecycle` field
PredicateKeyEnumName PredicateKeyEnum = "name" // Filter by `name` field
PredicateKeyEnumOwnerID PredicateKeyEnum = "owner_id" // Filter by `owner` field
PredicateKeyEnumOwnerIDs PredicateKeyEnum = "owner_ids" // Filter by `owner` hierarchy. Will return resources who's owner is in the team ancestry chain
PredicateKeyEnumProduct PredicateKeyEnum = "product" // Filter by `product` field
PredicateKeyEnumProperties PredicateKeyEnum = "properties" // Filter by custom-defined properties
PredicateKeyEnumRelationships PredicateKeyEnum = "relationships" // Filter by `relationships`
PredicateKeyEnumRepositoryIDs PredicateKeyEnum = "repository_ids" // Filter by Repository that this service is attached to, if any
PredicateKeyEnumSystemID PredicateKeyEnum = "system_id" // Filter by System that this service is assigned to, if any
PredicateKeyEnumTags PredicateKeyEnum = "tags" // Filter by `tags` field
PredicateKeyEnumTierIndex PredicateKeyEnum = "tier_index" // Filter by `tier` field
)

// All PredicateKeyEnum as []string
var AllPredicateKeyEnum = []string{
string(PredicateKeyEnumAliases),
string(PredicateKeyEnumComponentCategory),
string(PredicateKeyEnumComponentTypeID),
string(PredicateKeyEnumCreationSource),
string(PredicateKeyEnumDomainID),
Expand Down Expand Up @@ -3469,18 +3471,6 @@ var AllTypeEnum = []string{
string(TypeEnumStartsWith),
}

type RelationshipOperatorEnum string

var (
RelationshipOperatorEnumEquals RelationshipOperatorEnum = "EQUALS" // Matches a specific value
RelationshipOperatorEnumArrayContains RelationshipOperatorEnum = "ARRAY_CONTAINS" // Matches any value within an array
)

var AllRelationshipOperatorEnum = []string{
string(RelationshipOperatorEnumEquals),
string(RelationshipOperatorEnumArrayContains),
}

// UserRole A role that can be assigned to a user
type UserRole string

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
require (
dario.cat/mergo v1.0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/coder/websocket v1.8.13 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
Expand All @@ -44,4 +44,5 @@ require (
golang.org/x/net v0.43.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
Expand Down Expand Up @@ -91,7 +91,8 @@ golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading
Loading