Skip to content

Commit

Permalink
simplifycomposit lint cleanup (Snowflake-Labs#229)
Browse files Browse the repository at this point in the history
The new go language server really likes to complain about these.

## Test Plan
* [x] acceptance tests

## References
* microsoft/vscode#97406
  • Loading branch information
ryanking authored Jul 29, 2020
1 parent d590e4b commit 049eaae
Show file tree
Hide file tree
Showing 24 changed files with 159 additions and 159 deletions.
16 changes: 8 additions & 8 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,50 @@ import (
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"account": &schema.Schema{
"account": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_ACCOUNT", nil),
},
"username": &schema.Schema{
"username": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_USER", nil),
},
"password": &schema.Schema{
"password": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_PASSWORD", nil),
Sensitive: true,
ConflictsWith: []string{"browser_auth", "private_key_path", "oauth_access_token"},
},
"oauth_access_token": &schema.Schema{
"oauth_access_token": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_OAUTH_ACCESS_TOKEN", nil),
Sensitive: true,
ConflictsWith: []string{"browser_auth", "private_key_path", "password"},
},
"browser_auth": &schema.Schema{
"browser_auth": {
Type: schema.TypeBool,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_USE_BROWSER_AUTH", nil),
Sensitive: false,
ConflictsWith: []string{"password", "private_key_path", "oauth_access_token"},
},
"private_key_path": &schema.Schema{
"private_key_path": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_PRIVATE_KEY_PATH", nil),
Sensitive: true,
ConflictsWith: []string{"browser_auth", "password", "oauth_access_token"},
},
"role": &schema.Schema{
"role": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_ROLE", nil),
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("SNOWFLAKE_REGION", "us-west-2"),
Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/account_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ var validAccountPrivileges = newPrivilegeSet(
)

var accountGrantSchema = map[string]*schema.Schema{
"privilege": &schema.Schema{
"privilege": {
Type: schema.TypeString,
Optional: true,
Description: "The privilege to grant on the schema.",
Default: "USAGE",
ValidateFunc: validation.StringInSlice(validAccountPrivileges.toList(), true),
ForceNew: true,
},
"roles": &schema.Schema{
"roles": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Expand Down
10 changes: 5 additions & 5 deletions pkg/resources/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ import (
)

var databaseSchema = map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: false,
},
"comment": &schema.Schema{
"comment": {
Type: schema.TypeString,
Optional: true,
Default: "",
},
"data_retention_time_in_days": &schema.Schema{
"data_retention_time_in_days": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"from_share": &schema.Schema{
"from_share": {
Type: schema.TypeMap,
Description: "Specify a provider and a share in this map to create a database from a share.",
Optional: true,
ForceNew: true,
ConflictsWith: []string{"from_database"},
},
"from_database": &schema.Schema{
"from_database": {
Type: schema.TypeString,
Description: "Specify a database to create a clone from.",
Optional: true,
Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/database_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ var ValidDatabasePrivileges = newPrivilegeSet(
)

var databaseGrantSchema = map[string]*schema.Schema{
"database_name": &schema.Schema{
"database_name": {
Type: schema.TypeString,
Required: true,
Description: "The name of the database on which to grant privileges.",
ForceNew: true,
},
"privilege": &schema.Schema{
"privilege": {
Type: schema.TypeString,
Optional: true,
Description: "The privilege to grant on the database.",
Default: "USAGE",
ValidateFunc: validation.StringInSlice(ValidDatabasePrivileges.toList(), true),
ForceNew: true,
},
"roles": &schema.Schema{
"roles": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Description: "Grants privilege to these roles.",
ForceNew: true,
},
"shares": &schema.Schema{
"shares": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/integration_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ var validIntegrationPrivileges = newPrivilegeSet(
privilegeOwnership,
)
var integrationGrantSchema = map[string]*schema.Schema{
"integration_name": &schema.Schema{
"integration_name": {
Type: schema.TypeString,
Required: true,
Description: "Identifier for the integration; must be unique for your account.",
ForceNew: true,
},
"privilege": &schema.Schema{
"privilege": {
Type: schema.TypeString,
Optional: true,
Description: "The privilege to grant on the integration.",
Default: "USAGE",
ValidateFunc: validation.StringInSlice(validIntegrationPrivileges.toList(), true),
ForceNew: true,
},
"roles": &schema.Schema{
"roles": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Expand Down
20 changes: 10 additions & 10 deletions pkg/resources/managed_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,61 @@ var managedAccountProperties = []string{
}

var managedAccountSchema = map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: "Identifier for the managed account; must be unique for your account.",
ForceNew: true,
},
"admin_name": &schema.Schema{
"admin_name": {
Type: schema.TypeString,
Required: true,
Description: "Identifier, as well as login name, for the initial user in the managed account. This user serves as the account administrator for the account.",
ForceNew: true,
},
"admin_password": &schema.Schema{
"admin_password": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
Description: "Password for the initial user in the managed account.",
ValidateFunc: snowflakeValidation.ValidatePassword,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Optional: true,
Default: SnowflakeReaderAccountType,
Description: "Specifies the type of managed account.",
ValidateFunc: validation.StringInSlice([]string{SnowflakeReaderAccountType}, true),
ForceNew: true,
},
"comment": &schema.Schema{
"comment": {
Type: schema.TypeString,
Optional: true,
Description: "Specifies a comment for the managed account.",
ForceNew: true,
},
"cloud": &schema.Schema{
"cloud": {
Type: schema.TypeString,
Computed: true,
Description: "Cloud in which the managed account is located.",
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Computed: true,
Description: "Snowflake Region in which the managed account is located.",
},
"locator": &schema.Schema{
"locator": {
Type: schema.TypeString,
Computed: true,
Description: "Display name of the managed account.",
},
"created_on": &schema.Schema{
"created_on": {
Type: schema.TypeString,
Computed: true,
Description: "Date and time when the managed account was created.",
},
"url": &schema.Schema{
"url": {
Type: schema.TypeString,
Computed: true,
Description: "URL for accessing the managed account, particularly through the web interface.",
Expand Down
16 changes: 8 additions & 8 deletions pkg/resources/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ const (
)

var pipeSchema = map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Specifies the identifier for the pipe; must be unique for the database and schema in which the pipe is created.",
},
"schema": &schema.Schema{
"schema": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The schema in which to create the pipe.",
},
"database": &schema.Schema{
"database": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The database in which to create the pipe.",
},
"comment": &schema.Schema{
"comment": {
Type: schema.TypeString,
Optional: true,
Description: "Specifies a comment for the pipe.",
},
"copy_statement": &schema.Schema{
"copy_statement": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Expand All @@ -52,19 +52,19 @@ var pipeSchema = map[string]*schema.Schema{
return false
},
},
"auto_ingest": &schema.Schema{
"auto_ingest": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
Description: "Specifies a auto_ingest param for the pipe.",
},
"notification_channel": &schema.Schema{
"notification_channel": {
Type: schema.TypeString,
Computed: true,
Description: "Amazon Resource Name of the Amazon SQS queue for the stage named in the DEFINITION column.",
},
"owner": &schema.Schema{
"owner": {
Type: schema.TypeString,
Computed: true,
Description: "Name of the role that owns the pipe.",
Expand Down
16 changes: 8 additions & 8 deletions pkg/resources/resource_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,55 @@ import (
var validFrequencies = []string{"MONTHLY", "DAILY", "WEEKLY", "YEARLY", "NEVER"}

var resourceMonitorSchema = map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: "Identifier for the resource monitor; must be unique for your account.",
ForceNew: true,
},
"credit_quota": &schema.Schema{
"credit_quota": {
Type: schema.TypeFloat,
Optional: true,
Computed: true,
Description: "The amount of credits allocated monthly to the resource monitor, round up to 2 decimal places.",
ForceNew: true,
},
"frequency": &schema.Schema{
"frequency": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The frequency interval at which the credit usage resets to 0. If you set a frequency for a resource monitor, you must also set START_TIMESTAMP.",
ValidateFunc: validation.StringInSlice(validFrequencies, false),
ForceNew: true,
},
"start_timestamp": &schema.Schema{
"start_timestamp": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The date and time when the resource monitor starts monitoring credit usage for the assigned warehouses.",
ForceNew: true,
},
"end_timestamp": &schema.Schema{
"end_timestamp": {
Type: schema.TypeString,
Optional: true,
Description: "The date and time when the resource monitor suspends the assigned warehouses.",
ForceNew: true,
},
"suspend_triggers": &schema.Schema{
"suspend_triggers": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeInt},
Optional: true,
Description: "A list of percentage thresholds at which to suspend all warehouses.",
ForceNew: true,
},
"suspend_immediate_triggers": &schema.Schema{
"suspend_immediate_triggers": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeInt},
Optional: true,
Description: "A list of percentage thresholds at which to immediately suspend all warehouses.",
ForceNew: true,
},
"notify_triggers": &schema.Schema{
"notify_triggers": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeInt},
Optional: true,
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/resource_monitor_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ var validResourceMonitorPrivileges = newPrivilegeSet(
)

var resourceMonitorGrantSchema = map[string]*schema.Schema{
"monitor_name": &schema.Schema{
"monitor_name": {
Type: schema.TypeString,
Required: true,
Description: "Identifier for the resource monitor; must be unique for your account.",
ForceNew: true,
},
"privilege": &schema.Schema{
"privilege": {
Type: schema.TypeString,
Optional: true,
Description: "The privilege to grant on the resource monitor.",
Default: "MONITOR",
ValidateFunc: validation.StringInSlice(validResourceMonitorPrivileges.toList(), true),
ForceNew: true,
},
"roles": &schema.Schema{
"roles": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Expand Down
Loading

0 comments on commit 049eaae

Please sign in to comment.