-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Internal] Set SDK used in the useragent in context (#4092)
## Changes <!-- Summary of your changes that are easy to understand --> There are 2 SDKs -- sdkv2 and pluginframework. We set this information while setting useragent in the context for a resource and data source Context: #4085 (review) ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> Unit tests - [ ] `make test` run locally - [ ] relevant change in `docs/` folder - [ ] covered with integration tests in `internal/acceptance` - [ ] relevant acceptance tests are passing - [ ] using Go SDK
- Loading branch information
Showing
10 changed files
with
47 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
package common | ||
package context | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/databricks/databricks-sdk-go/useragent" | ||
"github.com/databricks/terraform-provider-databricks/internal/providers/common" | ||
) | ||
|
||
func SetResourceNameInContext(ctx context.Context, resourceName string) context.Context { | ||
const sdkName = "pluginframework" | ||
|
||
func SetUserAgentInResourceContext(ctx context.Context, resourceName string) context.Context { | ||
ctx = common.SetSDKInContext(ctx, sdkName) | ||
return useragent.InContext(ctx, "resource", resourceName) | ||
} | ||
|
||
func SetDataSourceNameInContext(ctx context.Context, dataSourceName string) context.Context { | ||
func SetUserAgentInDataSourceContext(ctx context.Context, dataSourceName string) context.Context { | ||
ctx = common.SetSDKInContext(ctx, sdkName) | ||
return useragent.InContext(ctx, "data", dataSourceName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters