Skip to content

Commit 7a587ee

Browse files
committed
Rename config.NewProviderWithSchema as NewProvider
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
1 parent 38bec5a commit 7a587ee

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

pkg/config/provider.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ func WithDefaultResourceFn(f DefaultResourceFn) ProviderOption {
154154
}
155155
}
156156

157-
// NewProviderWithSchema builds and returns a new Provider from provider
157+
// NewProvider builds and returns a new Provider from provider
158158
// tfjson schema, that is generated using Terraform CLI with:
159159
// `terraform providers schema --json`
160-
func NewProviderWithSchema(schema []byte, prefix string, modulePath string, metadataPath string, opts ...ProviderOption) *Provider {
160+
func NewProvider(schema []byte, prefix string, modulePath string, metadataPath string, opts ...ProviderOption) *Provider {
161161
ps := tfjson.ProviderSchemas{}
162162
if err := ps.UnmarshalJSON(schema); err != nil {
163163
panic(err)
@@ -170,13 +170,8 @@ func NewProviderWithSchema(schema []byte, prefix string, modulePath string, meta
170170
rs = v.ResourceSchemas
171171
break
172172
}
173-
return NewProvider(conversiontfjson.GetV2ResourceMap(rs), prefix, modulePath, metadataPath, opts...)
174-
}
175173

176-
// NewProvider builds and returns a new Provider.
177-
// Deprecated: This function will be removed soon, please use
178-
// NewProviderWithSchema instead.
179-
func NewProvider(resourceMap map[string]*schema.Resource, prefix string, modulePath string, metadataPath string, opts ...ProviderOption) *Provider {
174+
resourceMap := conversiontfjson.GetV2ResourceMap(rs)
180175
p := &Provider{
181176
ModulePath: modulePath,
182177
TerraformResourcePrefix: fmt.Sprintf("%s_", prefix),
@@ -213,7 +208,6 @@ func NewProvider(resourceMap map[string]*schema.Resource, prefix string, moduleP
213208

214209
p.Resources[name] = p.DefaultResourceFn(name, terraformResource)
215210
}
216-
217211
return p
218212
}
219213

pkg/pipeline/example.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
/*
2-
Copyright 2021 The Crossplane Authors.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
2+
Copyright 2022 Upbound Inc.
153
*/
164

175
package pipeline

pkg/types/reference_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestBuilder_generateReferenceFields(t *testing.T) {
124124
g := &Builder{
125125
comments: twtypes.Comments{},
126126
}
127-
gotFields, gotTags, _ := g.generateReferenceFields(tc.args.t, tc.args.f, tc.args.r)
127+
gotFields, gotTags := g.generateReferenceFields(tc.args.t, tc.args.f, &Field{Reference: &tc.args.r})
128128
if diff := cmp.Diff(tc.want.outFields, gotFields, cmp.Comparer(func(a, b *types.Var) bool {
129129
return a.String() == b.String()
130130
})); diff != "" {

0 commit comments

Comments
 (0)