Skip to content

Commit b2a1614

Browse files
committed
Rename struct AWSPlugin to Plugin
Keep it simple
1 parent 8c1062a commit b2a1614

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

internal/plugin.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
func NewAWSPlugin() schema.MachComposerPlugin {
16-
state := &AWSPlugin{
16+
state := &Plugin{
1717
provider: "3.74.1",
1818
siteConfigs: map[string]*SiteConfig{},
1919
componentConfigs: map[string]ComponentConfig{},
@@ -45,7 +45,7 @@ func NewAWSPlugin() schema.MachComposerPlugin {
4545
})
4646
}
4747

48-
type AWSPlugin struct {
48+
type Plugin struct {
4949
environment string
5050
provider string
5151
remoteState *AWSTFState
@@ -54,28 +54,28 @@ type AWSPlugin struct {
5454
endpointsConfigs map[string]map[string]EndpointConfig
5555
}
5656

57-
func (p *AWSPlugin) Configure(environment string, provider string) error {
57+
func (p *Plugin) Configure(environment string, provider string) error {
5858
p.environment = environment
5959
if provider != "" {
6060
p.provider = provider
6161
}
6262
return nil
6363
}
6464

65-
func (p *AWSPlugin) IsEnabled() bool {
65+
func (p *Plugin) IsEnabled() bool {
6666
return len(p.siteConfigs) > 0
6767
}
6868

69-
func (p *AWSPlugin) Identifier() string {
69+
func (p *Plugin) Identifier() string {
7070
return "aws"
7171
}
7272

73-
func (p *AWSPlugin) GetValidationSchema() (*schema.ValidationSchema, error) {
73+
func (p *Plugin) GetValidationSchema() (*schema.ValidationSchema, error) {
7474
result := getSchema()
7575
return result, nil
7676
}
7777

78-
func (p *AWSPlugin) SetRemoteStateBackend(data map[string]any) error {
78+
func (p *Plugin) SetRemoteStateBackend(data map[string]any) error {
7979
state := &AWSTFState{}
8080
if err := mapstructure.Decode(data, state); err != nil {
8181
return err
@@ -87,7 +87,7 @@ func (p *AWSPlugin) SetRemoteStateBackend(data map[string]any) error {
8787
return nil
8888
}
8989

90-
func (p *AWSPlugin) SetSiteConfig(site string, data map[string]any) error {
90+
func (p *Plugin) SetSiteConfig(site string, data map[string]any) error {
9191
if len(data) == 0 {
9292
return nil
9393
}
@@ -109,7 +109,7 @@ func (p *AWSPlugin) SetSiteConfig(site string, data map[string]any) error {
109109
return nil
110110
}
111111

112-
func (p *AWSPlugin) SetSiteEndpointsConfig(site string, data map[string]any) error {
112+
func (p *Plugin) SetSiteEndpointsConfig(site string, data map[string]any) error {
113113
configs := map[string]EndpointConfig{}
114114
for epId, epData := range data {
115115
cfg := EndpointConfig{}
@@ -142,7 +142,7 @@ func (p *AWSPlugin) SetSiteEndpointsConfig(site string, data map[string]any) err
142142
return nil
143143
}
144144

145-
func (p *AWSPlugin) SetComponentEndpointsConfig(component string, endpoints map[string]string) error {
145+
func (p *Plugin) SetComponentEndpointsConfig(component string, endpoints map[string]string) error {
146146
cfg, ok := p.componentConfigs[component]
147147
if !ok {
148148
cfg = ComponentConfig{}
@@ -153,7 +153,7 @@ func (p *AWSPlugin) SetComponentEndpointsConfig(component string, endpoints map[
153153
return nil
154154
}
155155

156-
func (p *AWSPlugin) TerraformRenderStateBackend(site string) (string, error) {
156+
func (p *Plugin) TerraformRenderStateBackend(site string) (string, error) {
157157
if p.remoteState == nil {
158158
return "", nil
159159
}
@@ -183,7 +183,7 @@ func (p *AWSPlugin) TerraformRenderStateBackend(site string) (string, error) {
183183
return helpers.RenderGoTemplate(template, templateContext)
184184
}
185185

186-
func (p *AWSPlugin) TerraformRenderProviders(site string) (string, error) {
186+
func (p *Plugin) TerraformRenderProviders(site string) (string, error) {
187187
cfg := p.getSiteConfig(site)
188188
if cfg == nil {
189189
return "", nil
@@ -196,7 +196,7 @@ func (p *AWSPlugin) TerraformRenderProviders(site string) (string, error) {
196196
return result, nil
197197
}
198198

199-
func (p *AWSPlugin) TerraformRenderResources(site string) (string, error) {
199+
func (p *Plugin) TerraformRenderResources(site string) (string, error) {
200200
cfg := p.getSiteConfig(site)
201201
if cfg == nil {
202202
return "", nil
@@ -237,7 +237,7 @@ func (p *AWSPlugin) TerraformRenderResources(site string) (string, error) {
237237
return content, nil
238238
}
239239

240-
func (p *AWSPlugin) RenderTerraformComponent(site string, component string) (*schema.ComponentSchema, error) {
240+
func (p *Plugin) RenderTerraformComponent(site string, component string) (*schema.ComponentSchema, error) {
241241
cfg := p.getSiteConfig(site)
242242
if cfg == nil {
243243
return nil, nil
@@ -257,7 +257,7 @@ func (p *AWSPlugin) RenderTerraformComponent(site string, component string) (*sc
257257
return result, nil
258258
}
259259

260-
func (p *AWSPlugin) getSiteConfig(site string) *SiteConfig {
260+
func (p *Plugin) getSiteConfig(site string) *SiteConfig {
261261
cfg, ok := p.siteConfigs[site]
262262
if !ok {
263263
return nil

0 commit comments

Comments
 (0)