Skip to content

Conversation

@andrewstillv15
Copy link
Contributor

@andrewstillv15 andrewstillv15 commented Dec 12, 2025

Resolves ##14198

Problem

follow up to #597 but for get.

Solution

func main() {
	client := opslevel.NewGQLClient(opslevel.SetAPIToken(PROD_KEY))
	if err := client.Validate(); err != nil {
		panic(err)
	}

	ComponentTypeTest(client)
}

func ComponentTypeTest(client *opslevel.Client) {
	input := opslevel.ComponentTypeInput{
		OwnerRelationship: &opslevel.OwnerRelationshipInput{
			ManagementRules: &[]opslevel.ManagementRuleInput{
				{
					Operator:              opslevel.RelationshipDefinitionManagementRuleOperatorEquals,
					SourceProperty:        "tag_key_eq:owner",
					SourcePropertyBuiltin: true,
					TargetProperty:        "name",
					TargetPropertyBuiltin: true,
					TargetType:            opslevel.NewNullableFrom("team"),
				},
				{
					Operator:              opslevel.RelationshipDefinitionManagementRuleOperatorEquals,
					SourceProperty:        "tag_key_eq:owner",
					SourcePropertyBuiltin: true,
					TargetProperty:        "alias",
					TargetPropertyBuiltin: true,
					TargetType:            opslevel.NewNullableFrom("team"),
				},
			},
		},
	}
	result, err := client.UpdateComponentType("aws_cloudfront_distribution", input)

	fmt.Println(result, err)

	getResult, getErr := client.GetComponentType("aws_cloudfront_distribution")
	if getErr != nil {
		fmt.Printf("Get failed: %v\n", getErr)
		return
	}
	fmt.Printf("Get succeeded: %+v\n", getResult)
}

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR does not reduce total test coverage
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Does this change require a Terraform schema change?
    • If so what is the ticket or PR #
  • Make a changie entry that explains the customer facing outcome of this change

@andrewstillv15 andrewstillv15 merged commit 1a4cd4e into main Dec 15, 2025
4 checks passed
@andrewstillv15 andrewstillv15 deleted the andrew/14198/add-support-for-owner-relationships-on-read branch December 15, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants