-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from logicmonitor/DEV-151049-UpdateTerraformPr…
…ovider Provider documentation update and fields added in website resource
- Loading branch information
Showing
32 changed files
with
787 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package schemata | ||
|
||
import ( | ||
"terraform-provider-logicmonitor/models" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func AuthenticationSchema() map[string]*schema.Schema { | ||
return map[string]*schema.Schema{ | ||
"domain": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
}, | ||
|
||
"password": { | ||
Type: schema.TypeString, | ||
Sensitive: true, | ||
Required: true, | ||
}, | ||
|
||
"type": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
|
||
"user_name": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
|
||
} | ||
} | ||
|
||
func SetAuthenticationSubResourceData(m []*models.Authentication) (d []*map[string]interface{}) { | ||
for _, authentication := range m { | ||
if authentication != nil { | ||
properties := make(map[string]interface{}) | ||
properties["domain"] = authentication.Domain | ||
properties["password"] = authentication.Password | ||
properties["type"] = authentication.Type | ||
properties["user_name"] = authentication.UserName | ||
d = append(d, &properties) | ||
} | ||
} | ||
return | ||
} | ||
|
||
func AuthenticationModel(d map[string]interface{}) *models.Authentication { | ||
// assume that the incoming map only contains the relevant resource data | ||
domain := d["domain"].(string) | ||
password := d["password"].(string) | ||
typeVar := d["type"].(string) | ||
userName := d["user_name"].(string) | ||
|
||
return &models.Authentication { | ||
Domain: domain, | ||
Password: &password, | ||
Type: &typeVar, | ||
UserName: &userName, | ||
} | ||
} | ||
|
||
func GetAuthenticationPropertyFields() (t []string) { | ||
return []string{ | ||
"domain", | ||
"password", | ||
"type", | ||
"user_name", | ||
} | ||
} |
Oops, something went wrong.