Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
query {
allOrganizations {
id
name
description
friendlyName
quotaProject
quotaGroup
quotaNotification
quotaEnvironment
quotaRoute
projects {
id
name
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ query (
}
autoIdle
developmentEnvironmentsLimit
organization
organizationDetails{
id
name
friendlyName
}
}
}
13 changes: 13 additions & 0 deletions api/lagoon/client/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,16 @@ func (c *Client) AllOrganizations(ctx context.Context, organizations *[]schema.O
Response: organizations,
})
}

func (c *Client) AllOrganizationsExtended(ctx context.Context, organizations *[]schema.Organization) error {
req, err := c.newRequest("_lgraphql/organizations/allOrganizationsWithProjects.graphql", nil)
if err != nil {
return err
}

return c.client.Run(ctx, req, &struct {
Response *[]schema.Organization `json:"allOrganizations"`
}{
Response: organizations,
})
}
7 changes: 7 additions & 0 deletions api/lagoon/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Organizations interface {
DeleteOrg(ctx context.Context, id uint, organization *schema.DeleteOrganizationInput) error
UpdateOrganization(ctx context.Context, id uint, patch schema.UpdateOrganizationPatchInput, result *schema.Organization) error
AllOrganizations(ctx context.Context, organizations *[]schema.Organization) error
AllOrganizationsExtended(ctx context.Context, organizations *[]schema.Organization) error
}

// GetOrganizationByID gets info of an organization in lagoon that matches the provided ID.
Expand Down Expand Up @@ -46,3 +47,9 @@ func AllOrganizations(ctx context.Context, o Organizations) (*[]schema.Organizat
organization := []schema.Organization{}
return &organization, o.AllOrganizations(ctx, &organization)
}

// AllOrganizationsExtended lists all organizations with associated projects.
func AllOrganizationsExtended(ctx context.Context, o Organizations) (*[]schema.Organization, error) {
organization := []schema.Organization{}
return &organization, o.AllOrganizationsExtended(ctx, &organization)
}
3 changes: 2 additions & 1 deletion api/schema/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ type Project struct {
// Openshift is unmarshalled during export.
OpenshiftID *OpenshiftID `json:"openshift,omitempty"`
// Groups are unmarshalled during export.
Groups []Group `json:"groups,omitempty"`
Groups []Group `json:"groups,omitempty"`
OrganizationDetails Organization `json:"organizationDetails,omitempty"`
}

// ProjectConfig contains project configuration.
Expand Down