add variable and method comments
This commit is contained in:
@@ -14,12 +14,14 @@ const (
|
||||
defaultHTTPTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
// DefaultHTTPClient is the default http client used if no client is provided.
|
||||
var DefaultHTTPClient = &http.Client{
|
||||
Timeout: defaultHTTPTimeout,
|
||||
}
|
||||
|
||||
var _ providers.Provider = &Client{}
|
||||
|
||||
// Client is the client to interact with the equinix metal graphql service.
|
||||
type Client struct {
|
||||
logger *zap.SugaredLogger
|
||||
httpClient *http.Client
|
||||
|
||||
@@ -2,11 +2,11 @@ package emgql
|
||||
|
||||
// Config provides configuration for connecting to the Equinix Metal API provider.
|
||||
type Config struct {
|
||||
|
||||
// BaseURL is the baseurl to use when connecting to the Equinix Metal API Provider.
|
||||
BaseURL string
|
||||
}
|
||||
|
||||
// Populated checks if any field has been populated.
|
||||
func (c Config) Populated() bool {
|
||||
return c.BaseURL != ""
|
||||
}
|
||||
|
||||
2
internal/metal/providers/emgql/doc.go
Normal file
2
internal/metal/providers/emgql/doc.go
Normal file
@@ -0,0 +1,2 @@
|
||||
// Package emgql implements a metal provider which fetches details from the Equinix Metal GraphQL.
|
||||
package emgql
|
||||
@@ -3,10 +3,12 @@ package emgql
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/models"
|
||||
"go.infratographer.com/x/gidx"
|
||||
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/models"
|
||||
)
|
||||
|
||||
// GetOrganizationDetails fetches the organization id provided with its memberships.
|
||||
func (c *Client) GetOrganizationDetails(ctx context.Context, id gidx.PrefixedID) (*models.OrganizationDetails, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package emgql
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/models"
|
||||
"go.infratographer.com/x/gidx"
|
||||
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/models"
|
||||
)
|
||||
|
||||
// GetProjectDetails fetchs the provided project id with membership information.
|
||||
func (c *Client) GetProjectDetails(ctx context.Context, id gidx.PrefixedID) (*models.ProjectDetails, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -8,14 +8,17 @@ import (
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/models"
|
||||
)
|
||||
|
||||
// GetUserDetails fetches the provided user id.
|
||||
func (c *Client) GetUserDetails(ctx context.Context, id gidx.PrefixedID) (*models.UserDetails, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetUserOrganizationRole returns collaborator for all organizations.
|
||||
func (c *Client) GetUserOrganizationRole(ctx context.Context, userID, orgID gidx.PrefixedID) (string, error) {
|
||||
return "collaborator", nil
|
||||
}
|
||||
|
||||
// GetUserProjectRole returns collaborator for all projects.
|
||||
func (c *Client) GetUserProjectRole(ctx context.Context, userID, projID gidx.PrefixedID) (string, error) {
|
||||
return "collaborator", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user