Skip to content

Commit

Permalink
feat: add compile time checks for config validator interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Sep 12, 2024
1 parent 635571d commit 902d587
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/provider/resource_access_jaas_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
// Ensure provider defined types fully satisfy framework interfaces.
var _ resource.Resource = &jaasAccessModelResource{}
var _ resource.ResourceWithConfigure = &jaasAccessModelResource{}
var _ resource.ResourceWithConfigValidators = &jaasAccessModelResource{}

// NewJAASAccessModelResource returns a new resource for JAAS model access.
func NewJAASAccessModelResource() resource.Resource {
Expand Down
1 change: 1 addition & 0 deletions internal/provider/resource_access_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
var _ resource.Resource = &accessModelResource{}
var _ resource.ResourceWithConfigure = &accessModelResource{}
var _ resource.ResourceWithImportState = &accessModelResource{}
var _ resource.ResourceWithConfigValidators = &accessModelResource{}

func NewAccessModelResource() resource.Resource {
return &accessModelResource{}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
var _ resource.Resource = &userResource{}
var _ resource.ResourceWithConfigure = &userResource{}
var _ resource.ResourceWithImportState = &userResource{}
var _ resource.ResourceWithConfigValidators = &userResource{}

func NewUserResource() resource.Resource {
return &userResource{}
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/validator_require_jaas.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type RequiresJAASValidator struct {
client *juju.Client
}

// NewRequiresJAASValidator returns a new validator that enforces a resource can
// only be created against JAAS.
func NewRequiresJAASValidator(client *juju.Client) RequiresJAASValidator {
return RequiresJAASValidator{
client: client,
Expand Down

0 comments on commit 902d587

Please sign in to comment.