Skip to content

Commit

Permalink
Merge pull request #53 from signalsciences/AuthenticateBeforePlan
Browse files Browse the repository at this point in the history
Authenticate before plan
  • Loading branch information
jhanrahan-sigsci authored Feb 10, 2022
2 parents d93757a + 6088f26 commit 4e59f8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions provider/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ var siteImporter = schema.ResourceImporter{
}

func validateConditionField(val interface{}, key string) ([]string, []error) {
if existsInString(val.(string), "scheme","method","path","useragent","domain","ip","responseCode","agentname","paramname","paramvalue","country","name","valueString","valueIp","signalType","signal", "requestHeader") {
if existsInString(val.(string), "scheme","method","path","useragent","domain","ip","responseCode","agentname","paramname","paramvalue","country","name","valueString","valueIp","signalType","signal", "requestHeader", "postParameter") {
return nil, nil
}
return []string{fmt.Sprintf("received '%s' for conditions.field, but it should probably be one of:\n(scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, signal, requestHeader)", val.(string))}, nil
return []string{fmt.Sprintf("received '%s' for conditions.field. This is not necessairly an error, but we only know about the following values. If this is a new value, please open a PR to get it added.\n(scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, signal, requestHeader, postParameter)", val.(string))}, nil
}
11 changes: 9 additions & 2 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ func providerConfigure() schema.ConfigureFunc {
if err != nil {
return nil, err
}
return providerMetadata{

metadata := providerMetadata{
Corp: d.Get("corp").(string),
Client: client.(sigsci.Client),
}, nil
}
// Test before continuing
_, err = metadata.Client.GetCorp(metadata.Corp)
if err != nil {
return nil, err
}
return metadata, nil
}
}

0 comments on commit 4e59f8f

Please sign in to comment.