add variable and method comments

This commit is contained in:
Mike Mason
2023-07-17 19:02:55 +00:00
parent 2681b3d064
commit bc87fa7726
35 changed files with 157 additions and 16 deletions

View File

@@ -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

View File

@@ -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 != ""
}

View File

@@ -0,0 +1,2 @@
// Package emgql implements a metal provider which fetches details from the Equinix Metal GraphQL.
package emgql

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}