Skip to content

Commit dd4b0a2

Browse files
authored
Merge pull request #26 from robertolosanno-e2x/feat/branches_support
Feat/branches support
2 parents c2b27e1 + 119dde0 commit dd4b0a2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Added
2+
body: Support for branches at provider level
3+
time: 2025-03-20T10:42:57.483691Z

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
160160
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
161161
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
162162
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
163-
github.com/labd/contentstack-go-sdk v0.0.0-20220603201036-f342c4fb5d4e h1:sLkJews6wpQiWGTrvDN+zUIfHZoajFKyFTRsbBZ+XbA=
164-
github.com/labd/contentstack-go-sdk v0.0.0-20220603201036-f342c4fb5d4e/go.mod h1:2pN/o4bC/yK/X+n/E/nOHvJssM0kLEUURtYZhsd3NOY=
163+
github.com/labd/contentstack-go-sdk v0.1.0 h1:lxBbGBkIlileNn2+VrVG6XP776Llxy9i4THPBA01xTU=
164+
github.com/labd/contentstack-go-sdk v0.1.0/go.mod h1:J17aqV8NOcmFfkkotnAljlt6Ctwlu21Ieeo/0BPLNtg=
165165
github.com/labd/contentstack-go-sdk v0.1.0 h1:lxBbGBkIlileNn2+VrVG6XP776Llxy9i4THPBA01xTU=
166166
github.com/labd/contentstack-go-sdk v0.1.0/go.mod h1:J17aqV8NOcmFfkkotnAljlt6Ctwlu21Ieeo/0BPLNtg=
167167
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=

internal/provider/provider.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func (p *provider) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics)
4848
Sensitive: true,
4949
Description: "The Authtoken is a read-write token used to make authorized CMA requests, and it is a user-specific token.",
5050
},
51+
"branch": {
52+
Type: types.StringType,
53+
Optional: true,
54+
Description: "The branch to manage resources in. If not specified, the main branch will be used.",
55+
},
5156
},
5257
}, nil
5358
}
@@ -58,6 +63,7 @@ type providerData struct {
5863
AuthToken types.String `tfsdk:"auth_token"`
5964
ApiKey types.String `tfsdk:"api_key"`
6065
ManagementToken types.String `tfsdk:"management_token"`
66+
Branch types.String `tfsdk:"branch"`
6167
}
6268

6369
func (p *provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderRequest, resp *tfsdk.ConfigureProviderResponse) {
@@ -90,6 +96,7 @@ func (p *provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderReq
9096
stackAuth := management.StackAuth{
9197
ApiKey: config.ApiKey.Value,
9298
ManagementToken: config.ManagementToken.Value,
99+
Branch: config.Branch.Value,
93100
}
94101

95102
instance, err := c.Stack(&stackAuth)

0 commit comments

Comments
 (0)