Skip to content

Commit

Permalink
Merge branch 'master' into expand-resource-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercactapus committed Apr 23, 2024
2 parents b94a64b + a094946 commit 56f4f05
Show file tree
Hide file tree
Showing 21 changed files with 554 additions and 625 deletions.
9 changes: 5 additions & 4 deletions gadb/models.go

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

40 changes: 24 additions & 16 deletions gadb/queries.sql.go

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

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 // indirect
github.com/jhump/protoreflect v1.15.3 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,9 @@ github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX
github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag=
github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
Expand Down
88 changes: 82 additions & 6 deletions graphql2/generated.go

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

3 changes: 3 additions & 0 deletions graphql2/graphqlapp/integrationkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func (m *Mutation) CreateIntegrationKey(ctx context.Context, input graphql2.Crea
Name: input.Name,
Type: integrationkey.Type(input.Type),
}
if input.ExternalSystemName != nil {
key.ExternalSystemName = *input.ExternalSystemName
}
key, err = m.IntKeyStore.Create(ctx, tx, key)
return err
})
Expand Down
2 changes: 2 additions & 0 deletions graphql2/models_gen.go

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

10 changes: 10 additions & 0 deletions graphql2/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,11 @@ input CreateIntegrationKeyInput {
serviceID: ID
type: IntegrationKeyType!
name: String!

"""
Name of the external system this key is managed by.
"""
externalSystemName: String
}

input CreateHeartbeatMonitorInput {
Expand Down Expand Up @@ -1044,6 +1049,11 @@ type IntegrationKey {
type: IntegrationKeyType!
name: String!
href: String!

"""
Name of the external system this key is managed by.
"""
externalSystemName: String
}

enum IntegrationKeyType {
Expand Down
3 changes: 3 additions & 0 deletions integrationkey/integrationkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ type IntegrationKey struct {
Name string `json:"name"`
Type Type `json:"type"`
ServiceID string `json:"service_id"`

ExternalSystemName string
}

func (i IntegrationKey) Normalize() (*IntegrationKey, error) {
err := validate.Many(
validate.IDName("Name", i.Name),
validate.UUID("ServiceID", i.ServiceID),
validate.OneOf("Type", i.Type, TypeGrafana, TypeSite24x7, TypePrometheusAlertmanager, TypeGeneric, TypeEmail),
validate.ASCII("ExternalSystemName", i.ExternalSystemName, 0, 255),
)
if err != nil {
return nil, err
Expand Down
10 changes: 6 additions & 4 deletions integrationkey/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ WHERE
AND type = $2;

-- name: IntKeyCreate :exec
INSERT INTO integration_keys(id, name, type, service_id)
VALUES ($1, $2, $3, $4);
INSERT INTO integration_keys(id, name, type, service_id, external_system_name)
VALUES ($1, $2, $3, $4, $5);

-- name: IntKeyFindOne :one
SELECT
id,
name,
type,
service_id
service_id,
external_system_name
FROM
integration_keys
WHERE
Expand All @@ -27,7 +28,8 @@ SELECT
id,
name,
type,
service_id
service_id,
external_system_name
FROM
integration_keys
WHERE
Expand Down
Loading

0 comments on commit 56f4f05

Please sign in to comment.