Skip to content

Commit

Permalink
added remaining integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-fbudzynski committed Sep 19, 2024
1 parent db1e931 commit 01a7006
Show file tree
Hide file tree
Showing 3 changed files with 505 additions and 94 deletions.
25 changes: 6 additions & 19 deletions pkg/sdk/secrets_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var secretDbRow = g.DbStruct("secretDBRow").
Field("owner", "string").
Field("comment", "sql.NullString").
Field("secret_type", "string").
Field("oauth_scopes", "sql.NullString"). // its a list tho
Field("oauth_scopes", "sql.NullString").
Field("owner_role_type", "string")

var secret = g.PlainStruct("Secret").
Expand All @@ -40,7 +40,7 @@ var secretDetailsDbRow = g.DbStruct("secretDetailsDBRow").
Field("username", "sql.NullString").
Time("oauth_access_token_expiry_time").
Time("oauth_refresh_token_expiry_time").
Field("oauth_scopes", "sql.NullString"). // its a list tho
Field("oauth_scopes", "sql.NullString").
Field("integration_name", "sql.NullString")

var secretDetails = g.PlainStruct("SecretDetails").
Expand All @@ -52,9 +52,9 @@ var secretDetails = g.PlainStruct("SecretDetails").
Field("Comment", "sql.NullString").
Field("SecretType", "string").
Field("Username", "sql.NullString").
Time("OauthAccessTokenExpiryTime").
Time("OauthRefreshTokenExpiryTime").
Field("OauthScopes", "sql.NullString"). // its a list tho
Field("OauthAccessTokenExpiryTime", "*time.Time").
Field("OauthRefreshTokenExpiryTime", "*time.Time").
Field("OauthScopes", "sql.NullString").
Field("IntegrationName", "sql.NullString")

var secretSet = g.NewQueryStruct("SecretSet").
Expand Down Expand Up @@ -87,9 +87,8 @@ var secretSet = g.NewQueryStruct("SecretSet").
).
WithValidation(g.ExactlyOneValueSet, "SetForOAuthClientCredentialsFlow", "SetForOAuthAuthorizationFlow", "SetForBasicAuthentication", "SetForGenericString")

// TODO: UNSET doest work, need to use "SET COMMENT = NULL"
// UNSET doest work, need to use "SET COMMENT = NULL"
var secretUnset = g.NewQueryStruct("SecretUnset").
//OptionalSQL("UNSET COMMENT")
PredefinedQueryStructField("Comment", "*bool", g.KeywordOptions().SQL("SET COMMENT = NULL"))

var SecretsDef = g.NewInterface(
Expand Down Expand Up @@ -199,18 +198,6 @@ var SecretsDef = g.NewInterface(
"https://docs.snowflake.com/en/sql-reference/sql/desc-secret",
secretDetailsDbRow,
secretDetails,

/*
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-secret",
g.DbStruct("secretDetailsRow").
Field("property", "string").
Field("value", "sql.NullString"),
g.PlainStruct("SecretDetails").
Field("Property", "string").
Field("Value", "string"),
*/

g.NewQueryStruct("DescribeSecret").
Describe().
SQL("SECRET").
Expand Down
9 changes: 5 additions & 4 deletions pkg/sdk/secrets_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sdk
import (
"context"
"database/sql"
"time"
)

type Secrets interface {
Expand Down Expand Up @@ -159,8 +160,8 @@ type secretDetailsDBRow struct {
Comment sql.NullString `db:"comment"`
SecretType string `db:"secret_type"`
Username sql.NullString `db:"username"`
OauthAccessTokenExpiryTime sql.NullString `db:"oauth_access_token_expiry_time"`
OauthRefreshTokenExpiryTime sql.NullString `db:"oauth_refresh_token_expiry_time"`
OauthAccessTokenExpiryTime *time.Time `db:"oauth_access_token_expiry_time"`
OauthRefreshTokenExpiryTime *time.Time `db:"oauth_refresh_token_expiry_time"`
OauthScopes sql.NullString `db:"oauth_scopes"`
IntegrationName sql.NullString `db:"integration_name"`
}
Expand All @@ -173,8 +174,8 @@ type SecretDetails struct {
Comment sql.NullString
SecretType string
Username sql.NullString
OauthAccessTokenExpiryTime sql.NullString
OauthRefreshTokenExpiryTime sql.NullString
OauthAccessTokenExpiryTime *time.Time
OauthRefreshTokenExpiryTime *time.Time
OauthScopes sql.NullString
IntegrationName sql.NullString
}
Loading

0 comments on commit 01a7006

Please sign in to comment.