Skip to content

Commit

Permalink
Revert changing case of boolean parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Oct 28, 2024
1 parent 9f15217 commit 4c95204
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pkg/resources/masking_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func CreateMaskingPolicy(ctx context.Context, d *schema.ResourceData, meta any)
opts.Comment = sdk.String(comment)
}
if v := d.Get("exempt_other_policies").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/resources/oauth_integration_for_custom_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,23 @@ func CreateContextOauthIntegrationForCustomClients(ctx context.Context, d *schem
req := sdk.NewCreateOauthForCustomClientsSecurityIntegrationRequest(id, oauthClientType, d.Get("oauth_redirect_uri").(string))

if v := d.Get("enabled").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
req.WithEnabled(parsedBool)
}

if v := d.Get("oauth_allow_non_tls_redirect_uri").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
req.WithOauthAllowNonTlsRedirectUri(parsedBool)
}

if v := d.Get("oauth_enforce_pkce").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func CreateContextOauthIntegrationForCustomClients(ctx context.Context, d *schem
}

if v := d.Get("oauth_issue_refresh_tokens").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -545,7 +545,7 @@ func UpdateContextOauthIntegrationForCustomClients(ctx context.Context, d *schem

if d.HasChange("enabled") {
if v := d.Get("enabled").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -557,7 +557,7 @@ func UpdateContextOauthIntegrationForCustomClients(ctx context.Context, d *schem

if d.HasChange("oauth_allow_non_tls_redirect_uri") {
if v := d.Get("oauth_allow_non_tls_redirect_uri").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -570,7 +570,7 @@ func UpdateContextOauthIntegrationForCustomClients(ctx context.Context, d *schem

if d.HasChange("oauth_enforce_pkce") {
if v := d.Get("oauth_enforce_pkce").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -613,7 +613,7 @@ func UpdateContextOauthIntegrationForCustomClients(ctx context.Context, d *schem

if d.HasChange("oauth_issue_refresh_tokens") {
if v := d.Get("oauth_issue_refresh_tokens").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/oauth_integration_for_partner_applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ func CreateContextOauthIntegrationForPartnerApplications(ctx context.Context, d
}

if v := d.Get("enabled").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
req.WithEnabled(parsedBool)
}

if v := d.Get("oauth_issue_refresh_tokens").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -422,7 +422,7 @@ func UpdateContextOauthIntegrationForPartnerApplications(ctx context.Context, d

if d.HasChange("enabled") {
if v := d.Get("oauth_issue_refresh_tokens").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(d.Get("enabled").(string))
parsedBool, err := booleanStringToBool(d.Get("enabled").(string))
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -434,7 +434,7 @@ func UpdateContextOauthIntegrationForPartnerApplications(ctx context.Context, d

if d.HasChange("oauth_issue_refresh_tokens") {
if v := d.Get("oauth_issue_refresh_tokens").(string); v != BooleanDefault {
parsedBool, err := BooleanStringToBool(v)
parsedBool, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/resource_helpers_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func intAttributeWithSpecialDefaultCreate(d *schema.ResourceData, key string, cr

func booleanStringAttributeCreate(d *schema.ResourceData, key string, createField **bool) error {
if v := d.Get(key).(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/resource_helpers_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func intAttributeWithSpecialDefaultUpdate(d *schema.ResourceData, key string, se
func booleanStringAttributeUpdate(d *schema.ResourceData, key string, setField **bool, unsetField **bool) error {
if d.HasChange(key) {
if v := d.Get(key).(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return err
}
Expand All @@ -56,7 +56,7 @@ func booleanStringAttributeUpdate(d *schema.ResourceData, key string, setField *
func booleanStringAttributeUnsetFallbackUpdate(d *schema.ResourceData, key string, setField **bool, fallbackValue bool) error {
if d.HasChange(key) {
if v := d.Get(key).(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return err
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/resources/saml2_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func CreateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,
)

if v := d.Get("enabled").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -381,15 +381,15 @@ func CreateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,
}

if v := d.Get("saml2_enable_sp_initiated").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
req.WithSaml2EnableSpInitiated(parsed)
}

if v := d.Get("saml2_sign_request").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -409,7 +409,7 @@ func CreateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,
}

if v := d.Get("saml2_force_authn").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -657,7 +657,7 @@ func UpdateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,

if d.HasChange("enabled") {
if v := d.Get("enabled").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -696,7 +696,7 @@ func UpdateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,

if d.HasChange("saml2_enable_sp_initiated") {
if v := d.Get("saml2_enable_sp_initiated").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -709,7 +709,7 @@ func UpdateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,

if d.HasChange("saml2_sign_request") {
if v := d.Get("saml2_sign_request").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -742,7 +742,7 @@ func UpdateContextSAML2Integration(ctx context.Context, d *schema.ResourceData,

if d.HasChange("saml2_force_authn") {
if v := d.Get("saml2_force_authn").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ func CreateContextSchema(ctx context.Context, d *schema.ResourceData, meta any)
}

if v := d.Get("is_transient").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
opts.Transient = sdk.Bool(parsed)
}
if v := d.Get("with_managed_access").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -330,7 +330,7 @@ func UpdateContextSchema(ctx context.Context, d *schema.ResourceData, meta any)
if d.HasChange("with_managed_access") {
if v := d.Get("with_managed_access").(string); v != BooleanDefault {
var err error
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/special_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func booleanStringFromBool(value bool) string {
}
}

func BooleanStringToBool(value string) (bool, error) {
func booleanStringToBool(value string) (bool, error) {
switch value {
case BooleanTrue:
return true, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func GetCreateUserFunc(userType sdk.UserType) func(ctx context.Context, d *schem
if userType == sdk.UserTypePerson {
// disable mfa cannot be set in create, we need to alter if set in config
if disableMfa := d.Get("disable_mfa").(string); disableMfa != BooleanDefault {
parsed, err := BooleanStringToBool(disableMfa)
parsed, err := booleanStringToBool(disableMfa)
if err != nil {
diags = append(diags, diag.Diagnostic{
Severity: diag.Warning,
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func CreateView(orReplace bool) schema.CreateContextFunc {
d.SetId(helpers.EncodeResourceIdentifier(id))

if v := d.Get("change_tracking").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -889,7 +889,7 @@ func UpdateView(ctx context.Context, d *schema.ResourceData, meta any) diag.Diag

if d.HasChange("is_secure") {
if v := d.Get("is_secure").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -906,7 +906,7 @@ func UpdateView(ctx context.Context, d *schema.ResourceData, meta any) diag.Diag
}
if d.HasChange("change_tracking") {
if v := d.Get("change_tracking").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func CreateWarehouse(ctx context.Context, d *schema.ResourceData, meta any) diag
createOptions.AutoSuspend = sdk.Int(v)
}
if v := d.Get("auto_resume").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -336,7 +336,7 @@ func CreateWarehouse(ctx context.Context, d *schema.ResourceData, meta any) diag
createOptions.Comment = sdk.String(v.(string))
}
if v := d.Get("enable_query_acceleration").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -527,7 +527,7 @@ func UpdateWarehouse(ctx context.Context, d *schema.ResourceData, meta any) diag
}
if d.HasChange("auto_resume") {
if v := d.Get("auto_resume").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -554,7 +554,7 @@ func UpdateWarehouse(ctx context.Context, d *schema.ResourceData, meta any) diag
}
if d.HasChange("enable_query_acceleration") {
if v := d.Get("enable_query_acceleration").(string); v != BooleanDefault {
parsed, err := BooleanStringToBool(v)
parsed, err := booleanStringToBool(v)
if err != nil {
return diag.FromErr(err)
}
Expand Down

0 comments on commit 4c95204

Please sign in to comment.