Skip to content

Commit

Permalink
Merge describe commons after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-asawicki committed Jun 28, 2024
1 parent e6e81fa commit 3e7a7f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
21 changes: 1 addition & 20 deletions pkg/schemas/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,6 @@ var DescribePropertyListSchema = &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: DescribePropertySchema,
},
}

var DescribePropertySchema = map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"type": {
Type: schema.TypeString,
Computed: true,
},
"value": {
Type: schema.TypeString,
Computed: true,
},
"default": {
Type: schema.TypeString,
Computed: true,
Schema: ShowSecurityIntegrationPropertySchema,
},
}
10 changes: 2 additions & 8 deletions pkg/schemas/scim_security_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,14 @@ var _ = DescribeScimSecurityIntegrationSchema
func ScimSecurityIntegrationPropertiesToSchema(securityIntegrationProperties []sdk.SecurityIntegrationProperty) map[string]any {
securityIntegrationSchema := make(map[string]any)
for _, securityIntegrationProperty := range securityIntegrationProperties {
securityIntegrationProperty := securityIntegrationProperty
switch securityIntegrationProperty.Name {
case "ENABLED",
"NETWORK_POLICY",
"RUN_AS_ROLE",
"SYNC_PASSWORD",
"COMMENT":
securityIntegrationSchema[strings.ToLower(securityIntegrationProperty.Name)] = []map[string]any{
{
"name": securityIntegrationProperty.Name,
"type": securityIntegrationProperty.Type,
"value": securityIntegrationProperty.Value,
"default": securityIntegrationProperty.Default,
},
}
securityIntegrationSchema[strings.ToLower(securityIntegrationProperty.Name)] = []map[string]any{SecurityIntegrationPropertyToSchema(&securityIntegrationProperty)}
}
}
return securityIntegrationSchema
Expand Down
11 changes: 1 addition & 10 deletions pkg/schemas/security_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,7 @@ import (

// TODO [SNOW-1348100]: multiple PRs touching the security integrations are in progress, this should be filled by all the possible properties (the mapping method below should be too)
var SecurityIntegrationDescribeSchema = map[string]*schema.Schema{
"todo": SecurityIntegrationListSchema,
}

// SecurityIntegrationListSchema represents Snowflake security integration property object.
var SecurityIntegrationListSchema = &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: ShowSecurityIntegrationPropertySchema,
},
"todo": DescribePropertyListSchema,
}

func SecurityIntegrationsDescriptionsToSchema(descriptions []sdk.SecurityIntegrationProperty) map[string]any {
Expand Down

0 comments on commit 3e7a7f3

Please sign in to comment.