Skip to content

Commit

Permalink
Rename example data source to OnePassword item data source
Browse files Browse the repository at this point in the history
  • Loading branch information
edif2008 committed Apr 18, 2024
1 parent 58a26c4 commit df2269c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import (
)

// Ensure provider defined types fully satisfy framework interfaces.
var _ datasource.DataSource = &ExampleDataSource{}
var _ datasource.DataSource = &OnePasswordItemDataSource{}

func NewExampleDataSource() datasource.DataSource {
return &ExampleDataSource{}
func NewOnePasswordItemDataSource() datasource.DataSource {
return &OnePasswordItemDataSource{}
}

// ExampleDataSource defines the data source implementation.
type ExampleDataSource struct {
// OnePasswordItemDataSource defines the data source implementation.
type OnePasswordItemDataSource struct {
client *http.Client
}

Expand All @@ -32,11 +32,11 @@ type ExampleDataSourceModel struct {
Id types.String `tfsdk:"id"`
}

func (d *ExampleDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
func (d *OnePasswordItemDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_example"
}

func (d *ExampleDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
func (d *OnePasswordItemDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
// This description is used by the documentation generator and the language server.
MarkdownDescription: "Example data source",
Expand All @@ -54,7 +54,7 @@ func (d *ExampleDataSource) Schema(ctx context.Context, req datasource.SchemaReq
}
}

func (d *ExampleDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
func (d *OnePasswordItemDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
// Prevent panic if the provider has not been configured.
if req.ProviderData == nil {
return
Expand All @@ -74,7 +74,7 @@ func (d *ExampleDataSource) Configure(ctx context.Context, req datasource.Config
d.client = client
}

func (d *ExampleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
func (d *OnePasswordItemDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var data ExampleDataSourceModel

// Read Terraform configuration data into the model
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (p *OnePasswordProvider) Resources(ctx context.Context) []func() resource.R

func (p *OnePasswordProvider) DataSources(ctx context.Context) []func() datasource.DataSource {
return []func() datasource.DataSource{
NewExampleDataSource,
NewOnePasswordItemDataSource,
NewOnePasswordVaultDataSource,
}
}
Expand Down

0 comments on commit df2269c

Please sign in to comment.