Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated logs and error handling data sets #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion provider/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func GetIdFromResponse(responseStr string, graphQlResponseKey string) (string, e
}
responseData, ok := response["data"].(map[string]interface{})
if !ok {
return "", fmt.Errorf("some error eccorred while fetching response")
return "", fmt.Errorf("some error occurred while fetching response")
}
updatedId, _ := responseData[graphQlResponseKey].(map[string]interface{})["id"].(string)
return updatedId, nil
Expand Down
9 changes: 6 additions & 3 deletions provider/data_classification/resource_data_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func ResourceDataSetsRule() *schema.Resource {

func ResourceDataSetsRuleCreate(rData *schema.ResourceData, meta interface{}) error {
name := rData.Get("name").(string)
if name == "" {
return fmt.Errorf("non empty string required")
}
description := rData.Get("description").(string)
iconType := rData.Get("icon_type").(string)
createQuery := GetDatSetQuery("", name, description, iconType)
Expand All @@ -48,7 +51,7 @@ func ResourceDataSetsRuleCreate(rData *schema.ResourceData, meta interface{}) er
log.Printf("This is the graphql response %s", responseStr)
id, err := common.GetIdFromResponse(responseStr, "createDataSet")
if err != nil {
return fmt.Errorf("error %s", err)
return fmt.Errorf("%s", err)
}
rData.SetId(id)
return nil
Expand Down Expand Up @@ -91,7 +94,7 @@ func ResourceDataSetsRuleUpdate(rData *schema.ResourceData, meta interface{}) er
log.Printf("This is the graphql response %s", responseStr)
updatedId, err := common.GetIdFromResponse(responseStr, "updateDataSet")
if err != nil {
return fmt.Errorf("error %s", err)
return fmt.Errorf("%s", err)
}
rData.SetId(updatedId)
return nil
Expand All @@ -102,7 +105,7 @@ func ResourceDataSetsRuleDelete(d *schema.ResourceData, meta interface{}) error
query := fmt.Sprintf(DELETE_DATA_SET_QUERY, id)
_, err := common.CallExecuteQuery(query, meta)
if err != nil {
return fmt.Errorf("error %s", err)
return fmt.Errorf("%s", err)
}
d.SetId("")
return nil
Expand Down
7 changes: 4 additions & 3 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/traceableai/terraform-provider-traceable/provider/common"
"github.com/traceableai/terraform-provider-traceable/provider/custom_signature"
"github.com/traceableai/terraform-provider-traceable/provider/data_classification"
"github.com/traceableai/terraform-provider-traceable/provider/dlp"
"github.com/traceableai/terraform-provider-traceable/provider/enumeration"
"github.com/traceableai/terraform-provider-traceable/provider/label_management"
Expand Down Expand Up @@ -78,9 +79,9 @@ func Provider() *schema.Provider {
"traceable_custom_signature_testing": custom_signature.ResourceCustomSignatureTestingRule(),
// "traceable_api_exclusion_rule": ResourceApiExclusionRule(),
// "traceable_agent_token": ResourceAgentToken(),
// "traceable_data_classification_rule": data_classification.ResourceDataClassification(),
// "traceable_data_classification_overrides": data_classification.ResourceDataClassificationOverrides(),
// "traceable_data_sets": data_classification.ResourceDataSetsRule(),
"traceable_data_classification_rule": data_classification.ResourceDataClassification(),
"traceable_data_classification_overrides": data_classification.ResourceDataClassificationOverrides(),
"traceable_data_sets": data_classification.ResourceDataSetsRule(),
},
DataSourcesMap: map[string]*schema.Resource{
// "traceable_notification_channels": DataSourceNotificationChannel(),
Expand Down