Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db/remove entity owner struct #300

Merged
merged 2 commits into from
Nov 10, 2023
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/Removed-20231110-122504.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Removed
body: EntityOwner removed, replaced with TeamId since Groups are deprecated
time: 2023-11-10T12:25:04.913673-06:00
10 changes: 5 additions & 5 deletions domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ type DomainId Identifier

type Domain struct {
DomainId
Name string `graphql:"name"`
Description string `graphql:"description"`
HTMLUrl string `graphql:"htmlUrl"`
Owner EntityOwner `graphql:"owner"`
Note string `graphql:"note"`
Name string `graphql:"name"`
Description string `graphql:"description"`
HTMLUrl string `graphql:"htmlUrl"`
Owner TeamId `graphql:"owner"`
Note string `graphql:"note"`
}

type DomainConnection struct {
Expand Down
18 changes: 9 additions & 9 deletions domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestDomainCreate(t *testing.T) {
})

testRequest := NewTestRequest(
`"mutation DomainCreate($input:DomainInput!){domainCreate(input:$input){domain{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},errors{message,path}}}"`,
`"mutation DomainCreate($input:DomainInput!){domainCreate(input:$input){domain{id,aliases,name,description,htmlUrl,owner{alias,id},note},errors{message,path}}}"`,
`{"input": {{ template "domain_create_input" }} }`,
`{"data": {"domainCreate": {"domain": {{ template "domain1_response" }} }}}`,
)
Expand All @@ -35,12 +35,12 @@ func TestDomainCreate(t *testing.T) {
func TestDomainGetSystems(t *testing.T) {
// Arrange
testRequestOne := NewTestRequest(
`"query DomainChildSystemsList($after:String!$domain:IdentifierInput!$first:Int!){account{domain(input: $domain){childSystems(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},parent{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},note},{{ template "pagination_request" }}}}}}"`,
`"query DomainChildSystemsList($after:String!$domain:IdentifierInput!$first:Int!){account{domain(input: $domain){childSystems(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{alias,id},parent{id,aliases,name,description,htmlUrl,owner{alias,id},note},note},{{ template "pagination_request" }}}}}}"`,
`{ {{ template "first_page_variables" }}, "domain": { {{ template "id2" }} } }`,
`{ "data": { "account": { "domain": { "childSystems": { "nodes": [ {{ template "system1_response" }}, {{ template "system2_response" }} ], {{ template "pagination_initial_pageInfo_response" }} }}}}}`,
)
testRequestTwo := NewTestRequest(
`"query DomainChildSystemsList($after:String!$domain:IdentifierInput!$first:Int!){account{domain(input: $domain){childSystems(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},parent{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},note},{{ template "pagination_request" }}}}}}"`,
`"query DomainChildSystemsList($after:String!$domain:IdentifierInput!$first:Int!){account{domain(input: $domain){childSystems(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{alias,id},parent{id,aliases,name,description,htmlUrl,owner{alias,id},note},note},{{ template "pagination_request" }}}}}}"`,
`{ {{ template "second_page_variables" }}, "domain": { {{ template "id2" }} } }`,
`{ "data": { "account": { "domain": { "childSystems": { "nodes": [ {{ template "system3_response" }} ], {{ template "pagination_second_pageInfo_response" }} }}}}}`,
)
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestDomainGetTags(t *testing.T) {
func TestDomainAssignSystem(t *testing.T) {
// Arrange
testRequest := NewTestRequest(
`"mutation DomainAssignSystem($childSystems:[IdentifierInput!]!$domain:IdentifierInput!){domainChildAssign(domain:$domain, childSystems:$childSystems){domain{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},errors{message,path}}}"`,
`"mutation DomainAssignSystem($childSystems:[IdentifierInput!]!$domain:IdentifierInput!){domainChildAssign(domain:$domain, childSystems:$childSystems){domain{id,aliases,name,description,htmlUrl,owner{alias,id},note},errors{message,path}}}"`,
`{"domain":{ {{ template "id1" }} }, "childSystems": [ { {{ template "id3" }} } ] }`,
`{"data": {"domainChildAssign": {"domain": {{ template "domain1_response" }} }}}`,
)
Expand All @@ -116,7 +116,7 @@ func TestDomainAssignSystem(t *testing.T) {
func TestDomainGetId(t *testing.T) {
// Arrange
testRequest := NewTestRequest(
`"query DomainGet($input:IdentifierInput!){account{domain(input: $input){id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note}}}"`,
`"query DomainGet($input:IdentifierInput!){account{domain(input: $input){id,aliases,name,description,htmlUrl,owner{alias,id},note}}}"`,
`{"input": { {{ template "id1" }} }}`,
`{"data": {"account": {"domain": {{ template "domain1_response" }} }}}`,
)
Expand All @@ -132,7 +132,7 @@ func TestDomainGetId(t *testing.T) {
func TestDomainGetAlias(t *testing.T) {
// Arrange
testRequest := NewTestRequest(
`"query DomainGet($input:IdentifierInput!){account{domain(input: $input){id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note}}}"`,
`"query DomainGet($input:IdentifierInput!){account{domain(input: $input){id,aliases,name,description,htmlUrl,owner{alias,id},note}}}"`,
`{"input": {"alias": "my-domain" }}`,
`{"data": {"account": {"domain": {{ template "domain1_response" }} }}}`,
)
Expand All @@ -148,12 +148,12 @@ func TestDomainGetAlias(t *testing.T) {
func TestDomainList(t *testing.T) {
// Arrange
testRequestOne := NewTestRequest(
`"query DomainsList($after:String!$first:Int!){account{domains(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},{{ template "pagination_request" }}}}}"`,
`"query DomainsList($after:String!$first:Int!){account{domains(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{alias,id},note},{{ template "pagination_request" }}}}}"`,
`{{ template "pagination_initial_query_variables" }}`,
`{ "data": { "account": { "domains": { "nodes": [ {{ template "domain1_response" }}, {{ template "domain2_response" }} ], {{ template "pagination_initial_pageInfo_response" }} }}}}`,
)
testRequestTwo := NewTestRequest(
`"query DomainsList($after:String!$first:Int!){account{domains(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},{{ template "pagination_request" }}}}}"`,
`"query DomainsList($after:String!$first:Int!){account{domains(after: $after, first: $first){nodes{id,aliases,name,description,htmlUrl,owner{alias,id},note},{{ template "pagination_request" }}}}}"`,
`{{ template "pagination_second_query_variables" }}`,
`{ "data": { "account": { "domains": { "nodes": [ {{ template "domain3_response" }} ], {{ template "pagination_second_pageInfo_response" }} }}}}`,
)
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestDomainUpdate(t *testing.T) {
})

testRequest := NewTestRequest(
`"mutation DomainUpdate($domain:IdentifierInput!$input:DomainInput!){domainUpdate(domain:$domain,input:$input){domain{id,aliases,name,description,htmlUrl,owner{... on Team{teamAlias:alias,id}},note},errors{message,path}}}"`,
`"mutation DomainUpdate($domain:IdentifierInput!$input:DomainInput!){domainUpdate(domain:$domain,input:$input){domain{id,aliases,name,description,htmlUrl,owner{alias,id},note},errors{message,path}}}"`,
`{"domain": { {{ template "id1" }} }, "input": {{ template "domain_update_input" }} }`,
`{"data": {"domainUpdate": {"domain": {{ template "domain1_response" }} }}}`,
)
Expand Down
2 changes: 1 addition & 1 deletion infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type InfrastructureResource struct {
Schema string `json:"type" graphql:"type @include(if: $all)"`
ProviderType string `json:"providerResourceType" graphql:"providerResourceType @include(if: $all)"`
ProviderData InfrastructureResourceProviderData `json:"providerData" graphql:"providerData @include(if: $all)"`
Owner EntityOwner `json:"owner" graphql:"owner @include(if: $all)"`
Owner TeamId `json:"owner" graphql:"owner @include(if: $all)"`
OwnerLocked bool `json:"ownerLocked" graphql:"ownerLocked @include(if: $all)"`
ParsedData JSON `json:"data" scalar:"true" graphql:"data @include(if: $all)"`
Data JSON `json:"rawData" scalar:"true" graphql:"rawData @include(if: $all)"`
Expand Down
10 changes: 5 additions & 5 deletions infra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func TestCreateInfra(t *testing.T) {
// Arrange
testRequest := NewTestRequest(
`"mutation InfrastructureResourceCreate($all:Boolean!$input:InfrastructureResourceInput!){infrastructureResourceCreate(input: $input){infrastructureResource{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){... on Team{teamAlias:alias,id}},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},warnings{message},errors{message,path}}}"`,
`"mutation InfrastructureResourceCreate($all:Boolean!$input:InfrastructureResourceInput!){infrastructureResourceCreate(input: $input){infrastructureResource{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){alias,id},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},warnings{message},errors{message,path}}}"`,
`{
"all": true,
"input": {
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestCreateInfra(t *testing.T) {
func TestGetInfra(t *testing.T) {
// Arrange
testRequest := NewTestRequest(
`"query InfrastructureResourceGet($all:Boolean!$input:IdentifierInput!){account{infrastructureResource(input: $input){id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){... on Team{teamAlias:alias,id}},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)}}}"`,
`"query InfrastructureResourceGet($all:Boolean!$input:IdentifierInput!){account{infrastructureResource(input: $input){id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){alias,id},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)}}}"`,
`{"all": true, "input":{ {{ template "id1" }} }}`,
`{"data": { "account": { "infrastructureResource": {{ template "infra_1" }} }}}`,
)
Expand Down Expand Up @@ -101,12 +101,12 @@ func TestListInfraSchemas(t *testing.T) {
func TestListInfra(t *testing.T) {
// Arrange
testRequestOne := NewTestRequest(
`"query IntegrationList($after:String!$all:Boolean!$first:Int!){account{infrastructureResources(after: $after, first: $first){nodes{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){... on Team{teamAlias:alias,id}},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},{{ template "pagination_request" }}}}}"`,
`"query IntegrationList($after:String!$all:Boolean!$first:Int!){account{infrastructureResources(after: $after, first: $first){nodes{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){alias,id},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},{{ template "pagination_request" }}}}}"`,
`{ "after": "", "all": true, "first": 100 }`,
`{ "data": { "account": { "infrastructureResources": { "nodes": [ {{ template "infra_1" }}, {{ template "infra_2" }} ], {{ template "pagination_initial_pageInfo_response" }} }}}}`,
)
testRequestTwo := NewTestRequest(
`"query IntegrationList($after:String!$all:Boolean!$first:Int!){account{infrastructureResources(after: $after, first: $first){nodes{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){... on Team{teamAlias:alias,id}},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},{{ template "pagination_request" }}}}}"`,
`"query IntegrationList($after:String!$all:Boolean!$first:Int!){account{infrastructureResources(after: $after, first: $first){nodes{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){alias,id},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},{{ template "pagination_request" }}}}}"`,
`{ "after": "OA", "all": true, "first": 100 }`,
`{ "data": { "account": { "infrastructureResources": { "nodes": [ {{ template "infra_3" }} ], {{ template "pagination_second_pageInfo_response" }} }}}}`,
)
Expand All @@ -126,7 +126,7 @@ func TestListInfra(t *testing.T) {
func TestUpdateInfra(t *testing.T) {
// Arrange
testRequest := NewTestRequest(
`"mutation InfrastructureResourceUpdate($all:Boolean!$identifier:IdentifierInput!$input:InfrastructureResourceInput!){infrastructureResourceUpdate(infrastructureResource: $identifier, input: $input){infrastructureResource{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){... on Team{teamAlias:alias,id}},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},warnings{message},errors{message,path}}}"`,
`"mutation InfrastructureResourceUpdate($all:Boolean!$identifier:IdentifierInput!$input:InfrastructureResourceInput!){infrastructureResourceUpdate(infrastructureResource: $identifier, input: $input){infrastructureResource{id,aliases,name,type @include(if: $all),providerResourceType @include(if: $all),providerData @include(if: $all){accountName,externalUrl,providerName},owner @include(if: $all){alias,id},ownerLocked @include(if: $all),data @include(if: $all),rawData @include(if: $all)},warnings{message},errors{message,path}}}"`,
`{"all": true, "identifier": { {{ template "id1" }}}, "input": { "ownerId": "{{ template "id1_string" }}", "data": "{\"endpoint\":\"https://google.com\",\"engine\":\"BigQuery\",\"name\":\"my-big-query\",\"replica\":false}" }}`,
`{"data": { "infrastructureResourceUpdate": { "infrastructureResource": {{ template "infra_1" }}, "warnings": [], "errors": [] }}}`,
)
Expand Down
25 changes: 0 additions & 25 deletions owner.go

This file was deleted.

24 changes: 0 additions & 24 deletions owner_test.go

This file was deleted.

16 changes: 8 additions & 8 deletions scorecards.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ type ScorecardId struct {
type Scorecard struct {
ScorecardId

AffectsOverallServiceLevels bool `graphql:"affectsOverallServiceLevels"`
Description string `graphql:"description"` // optional
Filter Filter `graphql:"filter"` // optional
Name string `graphql:"name"`
Owner EntityOwner `graphql:"owner"`
PassingChecks int `graphql:"passingChecks"`
ServiceCount int `graphql:"serviceCount"`
ChecksCount int `graphql:"totalChecks"`
AffectsOverallServiceLevels bool `graphql:"affectsOverallServiceLevels"`
Description string `graphql:"description"` // optional
Filter Filter `graphql:"filter"` // optional
Name string `graphql:"name"`
Owner TeamId `graphql:"owner"`
PassingChecks int `graphql:"passingChecks"`
ServiceCount int `graphql:"serviceCount"`
ChecksCount int `graphql:"totalChecks"`
}

type ScorecardConnection struct {
Expand Down
14 changes: 7 additions & 7 deletions scorecards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestCreateScorecard(t *testing.T) {
autopilot.Ok(t, err)
autopilot.Equals(t, name, sc.Name)
autopilot.Equals(t, description, sc.Description)
autopilot.Equals(t, *fakeOwnerId, sc.Owner.Id())
autopilot.Equals(t, *fakeOwnerId, sc.Owner.Id)
autopilot.Equals(t, *fakeFilterId, sc.Filter.Id)
autopilot.Equals(t, true, sc.AffectsOverallServiceLevels)
}
Expand All @@ -62,7 +62,7 @@ func TestCreateScorecardDoesNotAffectServiceLevels(t *testing.T) {
autopilot.Ok(t, err)
autopilot.Equals(t, name, sc.Name)
autopilot.Equals(t, description, sc.Description)
autopilot.Equals(t, *fakeOwnerId, sc.Owner.Id())
autopilot.Equals(t, *fakeOwnerId, sc.Owner.Id)
autopilot.Equals(t, *fakeFilterId, sc.Filter.Id)
autopilot.Equals(t, false, sc.AffectsOverallServiceLevels)
}
Expand All @@ -89,7 +89,7 @@ func TestUpdateScorecard(t *testing.T) {
autopilot.Equals(t, *ol.NewID(scorecardId), sc.Id)
autopilot.Equals(t, name, sc.Name)
autopilot.Equals(t, description, sc.Description)
autopilot.Equals(t, *newOwnerId, sc.Owner.Id())
autopilot.Equals(t, *newOwnerId, sc.Owner.Id)
autopilot.Equals(t, *newFilterId, sc.Filter.Id)
autopilot.Equals(t, false, sc.AffectsOverallServiceLevels)
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestGetScorecard(t *testing.T) {
autopilot.Equals(t, *ol.NewID(scorecardId), sc.Id)
autopilot.Equals(t, name, sc.Name)
autopilot.Equals(t, description, sc.Description)
autopilot.Equals(t, *fakeOwnerId, sc.Owner.Id())
autopilot.Equals(t, *fakeOwnerId, sc.Owner.Id)
autopilot.Equals(t, *fakeFilterId, sc.Filter.Id)
autopilot.Equals(t, 10, sc.PassingChecks)
autopilot.Equals(t, 20, sc.ServiceCount)
Expand Down Expand Up @@ -153,14 +153,14 @@ func TestListScorecards(t *testing.T) {
autopilot.Equals(t, 3, response.TotalCount)
autopilot.Equals(t, "first scorecard", result[0].Name)
autopilot.Equals(t, ol.ConnectiveEnumAnd, result[0].Filter.Connective)
autopilot.Equals(t, *fakeOwnerId, result[0].Owner.Id())
autopilot.Equals(t, *fakeOwnerId, result[0].Owner.Id)
autopilot.Equals(t, 150, result[0].ServiceCount)
autopilot.Equals(t, "second scorecard", result[1].Name)
autopilot.Equals(t, ol.ConnectiveEnumOr, result[1].Filter.Connective)
autopilot.Equals(t, *fakeOwnerId, result[0].Owner.Id())
autopilot.Equals(t, *fakeOwnerId, result[0].Owner.Id)
autopilot.Equals(t, 22, result[1].ServiceCount)
autopilot.Equals(t, "third scorecard", result[2].Name)
autopilot.Equals(t, ol.Filter{}, result[2].Filter)
autopilot.Equals(t, *newOwnerId, result[2].Owner.Id())
autopilot.Equals(t, *newOwnerId, result[2].Owner.Id)
autopilot.Equals(t, 33, result[2].ServiceCount)
}
12 changes: 6 additions & 6 deletions system.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ type SystemId Identifier

type System struct {
SystemId
Name string `graphql:"name"`
Description string `graphql:"description"`
HTMLUrl string `graphql:"htmlUrl"`
Owner EntityOwner `graphql:"owner"`
Parent Domain `graphql:"parent"`
Note string `graphql:"note"`
Name string `graphql:"name"`
Description string `graphql:"description"`
HTMLUrl string `graphql:"htmlUrl"`
Owner TeamId `graphql:"owner"`
Parent Domain `graphql:"parent"`
Note string `graphql:"note"`
}

type SystemConnection struct {
Expand Down
Loading
Loading