Skip to content

Commit

Permalink
Merge branch 'main' into resolver-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rizzza authored Sep 26, 2023
2 parents 09741eb + d51c67c commit f6272f6
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 5 deletions.
3 changes: 3 additions & 0 deletions internal/ent/generated/loadbalancer.go

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

21 changes: 21 additions & 0 deletions internal/ent/generated/metadata_node.go

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

1 change: 1 addition & 0 deletions internal/ent/schema/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ func (LoadBalancer) Annotations() []schema.Annotation {
schema.Comment("Representation of a load balancer."),
prefixIDDirective(LoadBalancerPrefix),
entgql.Implements("IPAddressable"),
entgql.Implements("MetadataNode"),
entgql.RelayConnection(),
entgql.Mutations(
entgql.MutationCreate().Description("Input information to create a load balancer."),
Expand Down
15 changes: 15 additions & 0 deletions internal/ent/templates/metadata_node.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ define "model/additional/metadata_node" }}
{{- if eq $.Name "LoadBalancer" }}
// IsMetadataNode implements interface for MetadataNode
func ({{ $.Receiver }} {{ $.Name }}) IsMetadataNode() {}
{{ end }}
{{ end }}

{{ define "metadata_node" }}
{{ $pkg := base $.Config.Package }}
{{ template "header" $ }}

type MetadataNode interface {
IsMetadataNode()
}
{{ end }}
24 changes: 22 additions & 2 deletions internal/graphapi/gen_server.go

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

7 changes: 7 additions & 0 deletions internal/graphclient/gen_models.go

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

5 changes: 4 additions & 1 deletion internal/graphclient/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ interface IPAddressable {
}
"""A valid JSON string."""
scalar JSON
type LoadBalancer implements Node & IPAddressable @key(fields: "id") @prefixedID(prefix: "loadbal") {
type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "id") @prefixedID(prefix: "loadbal") {
"""The ID for the load balancer."""
id: ID!
createdAt: Time!
Expand Down Expand Up @@ -755,6 +755,9 @@ type Location @key(fields: "id") {
where: LoadBalancerWhereInput
): LoadBalancerConnection!
}
interface MetadataNode {
id: ID!
}
type Mutation {
"""Create a loadbalancer pool origin"""
loadBalancerOriginCreate(input: CreateLoadBalancerOriginInput!): LoadBalancerOriginCreatePayload!
Expand Down
5 changes: 4 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface IPAddressable {
}
"""A valid JSON string."""
scalar JSON
type LoadBalancer implements Node & IPAddressable @key(fields: "id") @prefixedID(prefix: "loadbal") {
type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "id") @prefixedID(prefix: "loadbal") {
"""The ID for the load balancer."""
id: ID!
createdAt: Time!
Expand Down Expand Up @@ -742,6 +742,9 @@ type Location @key(fields: "id") {
where: LoadBalancerWhereInput
): LoadBalancerConnection!
}
interface MetadataNode {
id: ID!
}
type Mutation {
"""Create a loadbalancer pool origin"""
loadBalancerOriginCreate(input: CreateLoadBalancerOriginInput!): LoadBalancerOriginCreatePayload!
Expand Down
2 changes: 1 addition & 1 deletion schema/ent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ https://relay.dev/graphql/connections.htm#sec-Cursor
scalar Cursor
"""A valid JSON string."""
scalar JSON
type LoadBalancer implements Node & IPAddressable @key(fields: "id") @prefixedID(prefix: "loadbal") {
type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "id") @prefixedID(prefix: "loadbal") {
"""The ID for the load balancer."""
id: ID!
createdAt: Time!
Expand Down
3 changes: 3 additions & 0 deletions schema/metadata.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface MetadataNode {
id: ID!
}

0 comments on commit f6272f6

Please sign in to comment.