Skip to content

Commit 7357260

Browse files
Rename resource names (#1494)
1 parent 17f7b5d commit 7357260

File tree

3 files changed

+36
-36
lines changed

3 files changed

+36
-36
lines changed

helm-framework/helm/data_source_helm_template.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ import (
3131
"sigs.k8s.io/yaml"
3232
)
3333

34-
var _ datasource.DataSource = &DataTemplate{}
35-
var _ datasource.DataSourceWithConfigure = &DataTemplate{}
34+
var _ datasource.DataSource = &HelmTemplate{}
35+
var _ datasource.DataSourceWithConfigure = &HelmTemplate{}
3636

37-
func NewDataTemplate() datasource.DataSource {
38-
return &DataTemplate{}
37+
func NewHelmTemplate() datasource.DataSource {
38+
return &HelmTemplate{}
3939
}
4040

41-
// DataTemplate represents the data source for rendering Helm chart templates
42-
type DataTemplate struct {
41+
// HelmTemplate represents the data source for rendering Helm chart templates
42+
type HelmTemplate struct {
4343
meta *Meta
4444
}
4545

46-
// DataTemplateModel holds the attributes for configuring the Helm chart templates
47-
type DataTemplateModel struct {
46+
// HelmTemplateModel holds the attributes for configuring the Helm chart templates
47+
type HelmTemplateModel struct {
4848
ID types.String `tfsdk:"id"`
4949
Name types.String `tfsdk:"name"`
5050
Repository types.String `tfsdk:"repository"`
@@ -122,17 +122,17 @@ type Postrender struct {
122122
BinaryPath types.String `tfsdk:"binary_path"`
123123
}
124124

125-
func (d *DataTemplate) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
125+
func (d *HelmTemplate) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
126126
if req.ProviderData != nil {
127127
d.meta = req.ProviderData.(*Meta)
128128
}
129129
}
130130

131-
func (d *DataTemplate) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
131+
func (d *HelmTemplate) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
132132
resp.TypeName = req.ProviderTypeName + "_template"
133133
}
134134

135-
func (d *DataTemplate) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
135+
func (d *HelmTemplate) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
136136
resp.Schema = schema.Schema{
137137
Description: "Data source to render Helm chart templates.",
138138
Attributes: map[string]schema.Attribute{
@@ -402,8 +402,8 @@ func convertStringsToTypesStrings(input []string) []types.String {
402402
}
403403

404404
// Reads the current state of the data template and will update the state with the data fetched
405-
func (d *DataTemplate) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
406-
var state DataTemplateModel
405+
func (d *HelmTemplate) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
406+
var state HelmTemplateModel
407407
resp.Diagnostics.Append(req.Config.Get(ctx, &state)...)
408408
if resp.Diagnostics.HasError() {
409409
return
@@ -656,7 +656,7 @@ func (d *DataTemplate) Read(ctx context.Context, req datasource.ReadRequest, res
656656
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
657657
}
658658

659-
func getTemplateValues(ctx context.Context, model *DataTemplateModel) (map[string]interface{}, diag.Diagnostics) {
659+
func getTemplateValues(ctx context.Context, model *HelmTemplateModel) (map[string]interface{}, diag.Diagnostics) {
660660
base := map[string]interface{}{}
661661
var diags diag.Diagnostics
662662

@@ -823,7 +823,7 @@ func getDataValue(base map[string]interface{}, set SetValue) diag.Diagnostics {
823823
return diags
824824
}
825825

826-
func logDataValues(ctx context.Context, values map[string]interface{}, model *DataTemplateModel) diag.Diagnostics {
826+
func logDataValues(ctx context.Context, values map[string]interface{}, model *HelmTemplateModel) diag.Diagnostics {
827827
var diags diag.Diagnostics
828828

829829
asJSON, err := json.Marshal(values)
@@ -851,7 +851,7 @@ func logDataValues(ctx context.Context, values map[string]interface{}, model *Da
851851
return diags
852852
}
853853

854-
func cloakDataSetValues(ctx context.Context, config map[string]interface{}, model *DataTemplateModel) diag.Diagnostics {
854+
func cloakDataSetValues(ctx context.Context, config map[string]interface{}, model *HelmTemplateModel) diag.Diagnostics {
855855
var diags diag.Diagnostics
856856

857857
if !model.SetSensitive.IsNull() && !model.SetSensitive.IsUnknown() {

helm-framework/helm/provider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,13 +637,13 @@ func (p *HelmProvider) Configure(ctx context.Context, req provider.ConfigureRequ
637637

638638
func (p *HelmProvider) DataSources(ctx context.Context) []func() datasource.DataSource {
639639
return []func() datasource.DataSource{
640-
NewDataTemplate,
640+
NewHelmTemplate,
641641
}
642642
}
643643

644644
func (p *HelmProvider) Resources(ctx context.Context) []func() resource.Resource {
645645
return []func() resource.Resource{
646-
NewHelmReleaseResource,
646+
NewHelmRelease,
647647
}
648648
}
649649

helm-framework/helm/resource_helm_release.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ import (
4141
)
4242

4343
var (
44-
_ resource.Resource = &HelmReleaseResource{}
45-
_ resource.ResourceWithUpgradeState = &HelmReleaseResource{}
46-
_ resource.ResourceWithModifyPlan = &HelmReleaseResource{}
47-
_ resource.ResourceWithImportState = &HelmReleaseResource{}
44+
_ resource.Resource = &HelmRelease{}
45+
_ resource.ResourceWithUpgradeState = &HelmRelease{}
46+
_ resource.ResourceWithModifyPlan = &HelmRelease{}
47+
_ resource.ResourceWithImportState = &HelmRelease{}
4848
)
4949

50-
type HelmReleaseResource struct {
50+
type HelmRelease struct {
5151
meta *Meta
5252
}
5353

54-
func NewHelmReleaseResource() resource.Resource {
55-
return &HelmReleaseResource{}
54+
func NewHelmRelease() resource.Resource {
55+
return &HelmRelease{}
5656
}
5757

5858
type HelmReleaseModel struct {
@@ -252,11 +252,11 @@ func NewNamespacePlanModifier() planmodifier.String {
252252
return &NamespacePlanModifier{}
253253
}
254254

255-
func (r *HelmReleaseResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
255+
func (r *HelmRelease) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
256256
resp.TypeName = req.ProviderTypeName + "_release"
257257
}
258258

259-
func (r *HelmReleaseResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
259+
func (r *HelmRelease) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
260260
resp.Schema = schema.Schema{
261261
Description: "Schema to define attributes that are available in the resource",
262262
Attributes: map[string]schema.Attribute{
@@ -595,7 +595,7 @@ func (r *HelmReleaseResource) Schema(ctx context.Context, req resource.SchemaReq
595595
}
596596
}
597597

598-
func (r *HelmReleaseResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
598+
func (r *HelmRelease) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
599599
// Ensure that the ProviderData is not nil
600600
if req.ProviderData == nil {
601601
return
@@ -616,7 +616,7 @@ func (r *HelmReleaseResource) Configure(ctx context.Context, req resource.Config
616616

617617
// maps version 0 state to the upgrade function.
618618
// If terraform detects data with version 0, we call upgrade to upgrade the state to the current schema version "1"
619-
func (r *HelmReleaseResource) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader {
619+
func (r *HelmRelease) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader {
620620
return map[int64]resource.StateUpgrader{
621621
0: {
622622
StateUpgrader: stateUpgradeV0toV1,
@@ -679,7 +679,7 @@ func mergeMaps(a, b map[string]interface{}) map[string]interface{} {
679679
return out
680680
}
681681

682-
func (r *HelmReleaseResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
682+
func (r *HelmRelease) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
683683
var state HelmReleaseModel
684684
diags := req.Plan.Get(ctx, &state)
685685
resp.Diagnostics.Append(diags...)
@@ -836,7 +836,7 @@ func (r *HelmReleaseResource) Create(ctx context.Context, req resource.CreateReq
836836
}
837837
}
838838

839-
func (r *HelmReleaseResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
839+
func (r *HelmRelease) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
840840
var state HelmReleaseModel
841841

842842
diags := req.State.Get(ctx, &state)
@@ -899,7 +899,7 @@ func (r *HelmReleaseResource) Read(ctx context.Context, req resource.ReadRequest
899899
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
900900
}
901901

902-
func (r *HelmReleaseResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
902+
func (r *HelmRelease) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
903903
var plan HelmReleaseModel
904904
diags := req.Plan.Get(ctx, &plan)
905905
resp.Diagnostics.Append(diags...)
@@ -1035,7 +1035,7 @@ func (r *HelmReleaseResource) Update(ctx context.Context, req resource.UpdateReq
10351035
}
10361036
}
10371037

1038-
func (r *HelmReleaseResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
1038+
func (r *HelmRelease) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
10391039
var state HelmReleaseModel
10401040
diags := req.State.Get(ctx, &state)
10411041

@@ -1664,7 +1664,7 @@ func checkChartDependencies(ctx context.Context, model *HelmReleaseModel, c *cha
16641664
return false, diags
16651665
}
16661666

1667-
func (r *HelmReleaseResource) StateUpgrade(ctx context.Context, version int, state map[string]interface{}, meta interface{}) (map[string]interface{}, diag.Diagnostics) {
1667+
func (r *HelmRelease) StateUpgrade(ctx context.Context, version int, state map[string]interface{}, meta interface{}) (map[string]interface{}, diag.Diagnostics) {
16681668
var diags diag.Diagnostics
16691669

16701670
if state["pass_credentials"] == nil {
@@ -1677,7 +1677,7 @@ func (r *HelmReleaseResource) StateUpgrade(ctx context.Context, version int, sta
16771677
return state, diags
16781678
}
16791679

1680-
func (r *HelmReleaseResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
1680+
func (r *HelmRelease) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
16811681
if req.Plan.Raw.IsNull() {
16821682
// resource is being destroyed
16831683
return
@@ -2056,7 +2056,7 @@ func resultToError(r *action.LintResult) error {
20562056
return fmt.Errorf("malformed chart or values: \n\t%s", strings.Join(messages, "\n\t"))
20572057
}
20582058

2059-
func (r *HelmReleaseResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
2059+
func (r *HelmRelease) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
20602060
namespace, name, err := parseImportIdentifier(req.ID)
20612061
if err != nil {
20622062
resp.Diagnostics.AddError(

0 commit comments

Comments
 (0)