Skip to content

Commit

Permalink
expose raw resourceRefs
Browse files Browse the repository at this point in the history
Signed-off-by: Bulat Shakirzyanov <83289+avalanche123@users.noreply.github.com>
  • Loading branch information
avalanche123 committed Dec 12, 2023
1 parent 95361ad commit 6ad842d
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 0 deletions.
152 changes: 152 additions & 0 deletions internal/graph/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions internal/graph/resolvers/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,18 @@ func (r *compositeResourceSpec) Resources(ctx context.Context, obj *model.Compos
return *out, nil
}

func (r *compositeResourceSpec) ResourceRefs(ctx context.Context, obj *model.CompositeResourceSpec) ([]model.ObjectReference, error) {
resourceRefs := make([]model.ObjectReference, 0, len(obj.ResourceReferences))
for i := range obj.ResourceReferences {
// Ignore nameless resource references
if obj.ResourceReferences[i].Name == "" {
continue
}
resourceRefs = append(resourceRefs, *model.GetObjectReference(&obj.ResourceReferences[i]))
}
return resourceRefs, nil
}

func (r *compositeResourceSpec) ConnectionSecret(ctx context.Context, obj *model.CompositeResourceSpec) (*model.Secret, error) {
if obj.WriteConnectionSecretToReference == nil {
return nil, nil
Expand Down
5 changes: 5 additions & 0 deletions schema/composite.gql
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ type CompositeResourceSpec {
"""
connectionSecret: Secret @goField(forceResolver: true)

"""
The `ObjectReference`s for the resources composed by this composite resources.
"""
resourceRefs: [ObjectReference!]!

"""
The resources of which this composite resource is composed.
"""
Expand Down

0 comments on commit 6ad842d

Please sign in to comment.