fix linting
This commit is contained in:
@@ -2,6 +2,7 @@ package models
|
||||
|
||||
import "go.infratographer.com/x/gidx"
|
||||
|
||||
// OrganizationDetails contains the organization and membership information.
|
||||
type OrganizationDetails struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -9,6 +10,7 @@ type OrganizationDetails struct {
|
||||
Projects []*ProjectDetails `json:"projects"`
|
||||
}
|
||||
|
||||
// PrefixedID returns the prefixed id for the organization.
|
||||
func (d *OrganizationDetails) PrefixedID() gidx.PrefixedID {
|
||||
if d.ID == "" {
|
||||
return gidx.NullPrefixedID
|
||||
|
||||
@@ -11,7 +11,7 @@ const (
|
||||
// MetalUserIssuer is the issuer that is used for metal api token users.
|
||||
MetalUserIssuer = "https://auth.equinix.com/"
|
||||
|
||||
// MetaluserIssuerIDPrefix is the issuer id prefix added by the issuer.
|
||||
// MetalUserIssuerIDPrefix is the issuer id prefix added by the issuer.
|
||||
MetalUserIssuerIDPrefix = "auth|"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ type Roles []string
|
||||
// Memberships contains a list of memberships
|
||||
type Memberships []*Membership
|
||||
|
||||
// ToDetailsWithOrganizationDetails convers the memberships to generic membership models with organization details.
|
||||
// ToDetailsWithOrganizationDetails converts the memberships to generic membership models with organization details.
|
||||
func (m Memberships) ToDetailsWithOrganizationDetails(orgDetails *models.OrganizationDetails) []*models.Membership[models.OrganizationDetails] {
|
||||
memberships := make([]*models.Membership[models.OrganizationDetails], len(m))
|
||||
|
||||
@@ -31,7 +31,7 @@ func (m Memberships) ToDetailsWithOrganizationDetails(orgDetails *models.Organiz
|
||||
return memberships
|
||||
}
|
||||
|
||||
// ToDetailsWithProjectDetails convers the memberships to generic membership models with project details.
|
||||
// ToDetailsWithProjectDetails converts the memberships to generic membership models with project details.
|
||||
func (m Memberships) ToDetailsWithProjectDetails(projDetails *models.ProjectDetails) []*models.Membership[models.ProjectDetails] {
|
||||
memberships := make([]*models.Membership[models.ProjectDetails], len(m))
|
||||
|
||||
@@ -60,7 +60,7 @@ type Membership struct {
|
||||
User *User `json:"user"`
|
||||
}
|
||||
|
||||
// ToDetailsWithOrganizationDetails convers the membership to generic membership model with organization details.
|
||||
// ToDetailsWithOrganizationDetails converts the membership to generic membership model with organization details.
|
||||
func (m *Membership) ToDetailsWithOrganizationDetails(orgDetails *models.OrganizationDetails) *models.Membership[models.OrganizationDetails] {
|
||||
if m.ID == "" {
|
||||
return nil
|
||||
@@ -74,7 +74,7 @@ func (m *Membership) ToDetailsWithOrganizationDetails(orgDetails *models.Organiz
|
||||
}
|
||||
}
|
||||
|
||||
// ToDetailsWithOrganizationDetails convers the membership to generic membership model with organization details.
|
||||
// ToDetailsWithProjectDetails converts the membership to generic membership model with organization details.
|
||||
func (m *Membership) ToDetailsWithProjectDetails(projDetails *models.ProjectDetails) *models.Membership[models.ProjectDetails] {
|
||||
if m.ID == "" {
|
||||
return nil
|
||||
|
||||
@@ -75,7 +75,7 @@ func (o *Organization) ToDetails() *models.OrganizationDetails {
|
||||
func (c *Client) getOrganizationWithMemberships(ctx context.Context, id string) (*Organization, error) {
|
||||
var org Organization
|
||||
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, organizationsPath+"/"+id+"?include=memberships.user", nil, &org)
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, organizationsPath+"/"+id+"?include=memberships.user", nil, &org) // nolint:bodyclose // body is closed by Do json decode.
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error loading organization: %w", err)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func (p *Project) ToDetails() *models.ProjectDetails {
|
||||
func (c *Client) getProjectWithMemberships(ctx context.Context, id string) (*Project, error) {
|
||||
var project Project
|
||||
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, projectsPath+"/"+id+"?include=memberships.user", nil, &project)
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, projectsPath+"/"+id+"?include=memberships.user", nil, &project) // nolint:bodyclose // body is closed by Do json decode.
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error loading organization: %w", err)
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (u *User) ToDetails() *models.UserDetails {
|
||||
func (c *Client) getUser(ctx context.Context, id string) (*User, error) {
|
||||
var user User
|
||||
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, usersPath+"/"+id, nil, &user)
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, usersPath+"/"+id, nil, &user) // nolint:bodyclose // body is closed by Do json decode.
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error loading organization: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user