Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmay-db committed Aug 29, 2024
1 parent 0f87059 commit d44754b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions internal/providers/pluginfw/resources/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Introduction
This document contains the good practices for any new resource or data source that will be introduced or migrated to plugin framework.
This document contains the good practices for any new resource or data source that will be introduced or migrated to the plugin framework.


## Migrating resource to plugin framework
Ideally there shouldn't be any behaviour change when migrating a resource / data source to either Go SDk or Plugin Framework. Make sure there is no schema differences, integration tests should largely remain similar to before.
Ideally there shouldn't be any behaviour change when migrating a resource or data source to either Go SDk or Plugin Framework. - Please make sure there are no breaking differences due to changes in schema by running: `make diff-schema`.
- Integration tests shouldn't require any major changes.


## Code Organization
Each resource should go into it's separate package eg: `volume` package will contain both resource, data sources and other utils specific to volumes. Tests (both unit and integration tests) will also remain in this package.

Only Docs will stay under root docs/ directory.
Note: Only Docs will stay under root docs/ directory.


## Code Convention
1. Make sure the resource or data source implemented is of the right type.
## Code Conventions
1. Make sure the resource or data source implemented is of the right type:
```golang
var _ resource.ResourceWithConfigure = &QualityMonitorResource{}
var _ datasource.DataSourceWithConfigure = &VolumesDataSource{}
```
2. To get the databricks client, `func (*common.DatabricksClient).GetWorkspaceClient()` or `func (*common.DatabricksClient).GetAccountClient()` will be used instead of directly using the underlying `WorkspaceClient()`, `AccountClient()` respectively.
3. Any method that returns diagnostics should be called inline while appending diagnostics in response. Example:
2. To get the databricks client, `func (*common.DatabricksClient).GetWorkspaceClient()` or `func (*common.DatabricksClient).GetAccountClient()` will be used instead of directly using the underlying `WorkspaceClient()`, `AccountClient()` functions respectively.
3. Any method that returns the diagnostics should be called inline while appending diagnostics in response. Example:
```golang
resp.Diagnostics.Append(req.Plan.Get(ctx, &monitorInfoTfSDK)...)
if resp.Diagnostics.HasError() {
Expand Down

0 comments on commit d44754b

Please sign in to comment.