Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
parkedwards committed Oct 21, 2023
1 parent b064d59 commit ccbf646
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions internal/api/bots.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
"github.com/google/uuid"
)

// BotsClient is a client for working with Service Accounts
// BotsClient is a client for working with Service Accounts.
type BotsClient interface {
Get(ctx context.Context, id uuid.UUID) (*Bot, error)
}

// BotAPIKey represents the nested API Key
// included in a Service Account response
// included in a Service Account response.
type BotAPIKey struct {
BaseModel
Name string `json:"name"`
Key *string `json:"key"`
Expiration *time.Time `json:"expiration"`
}

// Bot is the base representation of a Service Account
// Bot is the base representation of a Service Account.
type Bot struct {
BaseModel
Name string `json:"name"`
Expand Down
4 changes: 3 additions & 1 deletion internal/client/bots.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type BotsClient struct {
}

// Bots returns a BotsClient.
//
//nolint:ireturn // required to support PrefectClient mocking
func (c *Client) Bots() (api.BotsClient, error) {
return &BotsClient{
hc: c.hc,
Expand All @@ -28,7 +30,7 @@ func (c *Client) Bots() (api.BotsClient, error) {
}, nil
}

// Get a single bot by ID
// Get a single bot by ID.
func (c *BotsClient) Get(ctx context.Context, id uuid.UUID) (*api.Bot, error) {
path := fmt.Sprintf("%s/%s", c.routePrefix, id.String())
req, err := http.NewRequestWithContext(ctx, http.MethodGet, path, http.NoBody)
Expand Down
8 changes: 7 additions & 1 deletion internal/provider/datasources/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type BotDataSource struct {
// AccountDataSourceModel defines the Terraform data source model.
// the TF data source configuration will be unmarsheled into this struct
// NOTE: the APIKey field is not included in bot fetches and
// is excluded from this datasource model
// is excluded from this datasource model.
type BotDataSourceModel struct {
ID customtypes.UUIDValue `tfsdk:"id"`
Created customtypes.TimestampValue `tfsdk:"created"`
Expand All @@ -36,6 +36,10 @@ type BotDataSourceModel struct {
AccountRoleName types.String `tfsdk:"account_role_name"`
}

// NewBotDataSource returns a new BotDataSource,
// to be inserted into the provider during instantiation.
//
//nolint:ireturn // required by Terraform API
func NewBotDataSource() datasource.DataSource {
return &BotDataSource{}
}
Expand Down Expand Up @@ -115,6 +119,7 @@ func (d *BotDataSource) Read(ctx context.Context, req datasource.ReadRequest, re
"Error creating the Bots client",
fmt.Sprintf("Could not create Bots client, unexpected error: %s. This is a bug in the provider, please report this to the maintainers.", err.Error()),
)

return
}

Expand All @@ -124,6 +129,7 @@ func (d *BotDataSource) Read(ctx context.Context, req datasource.ReadRequest, re
"Failed to fetch Bot and refresh state",
fmt.Sprintf("Could not fetch Bot, unexpected error: %s", err.Error()),
)

return
}

Expand Down

0 comments on commit ccbf646

Please sign in to comment.