Skip to content

Commit

Permalink
chore: remove generating integration tests placeholder file (#3256)
Browse files Browse the repository at this point in the history
<!-- Feel free to delete comments as you fill this in -->

<!-- summary of changes -->
## Changes
- removed generation of integration_tests file
- added a print for the user to create the integration tests manually
- changed the `ShowByIdOperation` name to `ShowByIdOperationNoFiltering`
for no automatic generation of filtering options
- adjusted the template for ShowByID filtering
- removed `ShowByIDNoFiltering` option (replaced by
`ShowByIdOperationNoFiltering`)
- adjusted README of the SDK generator to the current state 

## References
<!-- issues documentation links, etc  -->
*
#3227
*
#3240
  • Loading branch information
sfc-gh-fbudzynski authored and sfc-gh-asawicki committed Dec 20, 2024
1 parent 3d7ba37 commit e0ed15b
Show file tree
Hide file tree
Showing 79 changed files with 222 additions and 195 deletions.
2 changes: 1 addition & 1 deletion pkg/datasources/materialized_views.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadMaterializedViews(ctx context.Context, d *schema.ResourceData, meta any

schemaId := sdk.NewDatabaseObjectIdentifier(databaseName, schemaName)
extractedMaterializedViews, err := client.MaterializedViews.Show(ctx, sdk.NewShowMaterializedViewRequest().WithIn(
&sdk.In{Schema: schemaId},
sdk.In{Schema: schemaId},
))
if err != nil {
log.Printf("[DEBUG] failed when searching materialized views in schema (%s), err = %s", schemaId.FullyQualifiedName(), err.Error())
Expand Down
8 changes: 4 additions & 4 deletions pkg/datasources/row_access_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ func ReadRowAccessPolicies(ctx context.Context, d *schema.ResourceData, meta any
if v, ok := d.GetOk("in"); ok {
in := v.([]any)[0].(map[string]any)
if v, ok := in["account"]; ok && v.(bool) {
req.WithIn(&sdk.ExtendedIn{In: sdk.In{Account: sdk.Bool(true)}})
req.WithIn(sdk.ExtendedIn{In: sdk.In{Account: sdk.Bool(true)}})
}
if v, ok := in["database"]; ok {
database := v.(string)
if database != "" {
req.WithIn(&sdk.ExtendedIn{In: sdk.In{Database: sdk.NewAccountObjectIdentifier(database)}})
req.WithIn(sdk.ExtendedIn{In: sdk.In{Database: sdk.NewAccountObjectIdentifier(database)}})
}
}
if v, ok := in["schema"]; ok {
Expand All @@ -143,7 +143,7 @@ func ReadRowAccessPolicies(ctx context.Context, d *schema.ResourceData, meta any
if err != nil {
return diag.FromErr(err)
}
req.WithIn(&sdk.ExtendedIn{In: sdk.In{Schema: schemaId}})
req.WithIn(sdk.ExtendedIn{In: sdk.In{Schema: schemaId}})
}
}
if v, ok := in["application"]; ok {
Expand All @@ -159,7 +159,7 @@ func ReadRowAccessPolicies(ctx context.Context, d *schema.ResourceData, meta any
}

if likePattern, ok := d.GetOk("like"); ok {
req.WithLike(&sdk.Like{
req.WithLike(sdk.Like{
Pattern: sdk.String(likePattern.(string)),
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/sequences.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ReadSequences(ctx context.Context, d *schema.ResourceData, meta any) diag.D
databaseName := d.Get("database").(string)
schemaName := d.Get("schema").(string)

req := sdk.NewShowSequenceRequest().WithIn(&sdk.In{
req := sdk.NewShowSequenceRequest().WithIn(sdk.In{
Schema: sdk.NewDatabaseObjectIdentifier(databaseName, schemaName),
})
seqs, err := client.Sequences.Show(ctx, req)
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ReadStages(ctx context.Context, d *schema.ResourceData, meta any) diag.Diag
schemaName := d.Get("schema").(string)

stages, err := client.Stages.Show(ctx, sdk.NewShowStageRequest().WithIn(
&sdk.In{
sdk.In{
Schema: sdk.NewDatabaseObjectIdentifier(databaseName, schemaName),
},
))
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/api_integrations_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ var ApiIntegrationsDef = g.NewInterface(
SQL("API INTEGRATIONS").
OptionalLike(),
).
ShowByIdOperation().
ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
).
DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-integration",
Expand Down
4 changes: 2 additions & 2 deletions pkg/sdk/api_integrations_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/sdk/api_integrations_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func (v *apiIntegrations) Show(ctx context.Context, request *ShowApiIntegrationR
}

func (v *apiIntegrations) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*ApiIntegration, error) {
apiIntegrations, err := v.Show(ctx, NewShowApiIntegrationRequest().WithLike(&Like{
Pattern: String(id.Name()),
}))
request := NewShowApiIntegrationRequest().
WithLike(Like{Pattern: String(id.Name())})
apiIntegrations, err := v.Show(ctx, request)
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/application_packages_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,6 @@ var ApplicationPackagesDef = g.NewInterface(
OptionalLike().
OptionalStartsWith().
OptionalLimit(),
).ShowByIdOperation()
).ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
)
4 changes: 2 additions & 2 deletions pkg/sdk/application_packages_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/sdk/application_packages_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func (v *applicationPackages) Show(ctx context.Context, request *ShowApplication
}

func (v *applicationPackages) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*ApplicationPackage, error) {
request := NewShowApplicationPackageRequest().WithLike(&Like{String(id.Name())})
request := NewShowApplicationPackageRequest().
WithLike(Like{Pattern: String(id.Name())})
applicationPackages, err := v.Show(ctx, request)
if err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/applications_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ var ApplicationsDef = g.NewInterface(
OptionalLike().
OptionalStartsWith().
OptionalLimit(),
).ShowByIdOperation().DescribeOperation(
).ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
).DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-application",
g.DbStruct("applicationPropertyRow").
Expand Down
4 changes: 2 additions & 2 deletions pkg/sdk/applications_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/sdk/applications_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func (v *applications) Show(ctx context.Context, request *ShowApplicationRequest
}

func (v *applications) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*Application, error) {
request := NewShowApplicationRequest().WithLike(&Like{String(id.Name())})
request := NewShowApplicationRequest().
WithLike(Like{Pattern: String(id.Name())})
applications, err := v.Show(ctx, request)
if err != nil {
return nil, err
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/authentication_policies_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ var AuthenticationPoliciesDef = g.NewInterface(
OptionalStartsWith().
OptionalLimit(),
).
ShowByIdOperation().
ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
g.ShowByIDInFiltering,
).
DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-authentication-policy",
Expand Down
9 changes: 4 additions & 5 deletions pkg/sdk/authentication_policies_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ func (v *authenticationPolicies) Show(ctx context.Context, request *ShowAuthenti
}

func (v *authenticationPolicies) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*AuthenticationPolicy, error) {
authenticationPolicies, err := v.Show(ctx, NewShowAuthenticationPolicyRequest().WithIn(In{
Schema: id.SchemaId(),
}).WithLike(Like{
Pattern: String(id.Name()),
}))
request := NewShowAuthenticationPolicyRequest().
WithLike(Like{Pattern: String(id.Name())}).
WithIn(In{Schema: id.SchemaId()})
authenticationPolicies, err := v.Show(ctx, request)
if err != nil {
return nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/cortex_search_services_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ var CortexSearchServiceDef = g.NewInterface(
OptionalIn().
OptionalStartsWith().
OptionalLimitFrom(),
).ShowByIdOperation().DescribeOperation(
).ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
g.ShowByIDInFiltering,
).DescribeOperation(
g.DescriptionMappingKindSingleValue,
"https://docs.snowflake.com/LIMITEDACCESS/cortex-search/sql/desc-cortex-search",
g.DbStruct("cortexSearchServiceDetailsRow").
Expand Down
4 changes: 2 additions & 2 deletions pkg/sdk/cortex_search_services_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (v *cortexSearchServices) Show(ctx context.Context, request *ShowCortexSear

func (v *cortexSearchServices) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*CortexSearchService, error) {
request := NewShowCortexSearchServiceRequest().
WithIn(In{Schema: id.SchemaId()}).
WithLike(Like{Pattern: String(id.Name())})
WithLike(Like{Pattern: String(id.Name())}).
WithIn(In{Schema: id.SchemaId()})
cortexSearchServices, err := v.Show(ctx, request)
if err != nil {
return nil, err
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/event_tables_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ var EventTablesDef = g.NewInterface(
OptionalIn().
OptionalStartsWith().
OptionalLimit(),
).ShowByIdOperation().DescribeOperation(
).ShowByIdOperationWithFiltering(
g.ShowByIDInFiltering,
g.ShowByIDLikeFiltering,
).DescribeOperation(
g.DescriptionMappingKindSingleValue,
"https://docs.snowflake.com/en/sql-reference/sql/desc-event-table",
g.DbStruct("eventTableDetailsRow").
Expand Down
8 changes: 4 additions & 4 deletions pkg/sdk/event_tables_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/sdk/event_tables_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func (v *eventTables) Show(ctx context.Context, request *ShowEventTableRequest)
}

func (v *eventTables) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*EventTable, error) {
request := NewShowEventTableRequest().WithIn(&In{Schema: id.SchemaId()}).WithLike(&Like{String(id.Name())})
request := NewShowEventTableRequest().
WithIn(In{Schema: id.SchemaId()}).
WithLike(Like{Pattern: String(id.Name())})
eventTables, err := v.Show(ctx, request)
if err != nil {
return nil, err
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/external_functions_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ var ExternalFunctionsDef = g.NewInterface(
SQL("EXTERNAL FUNCTIONS").
OptionalLike().
OptionalIn(),
).ShowByIdOperation().DescribeOperation(
).ShowByIdOperationWithFiltering(
g.ShowByIDInFiltering,
g.ShowByIDLikeFiltering,
).DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-function",
g.DbStruct("externalFunctionPropertyRow").
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/external_functions_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func (v *externalFunctions) Show(ctx context.Context, request *ShowExternalFunct
}

func (v *externalFunctions) ShowByID(ctx context.Context, id SchemaObjectIdentifierWithArguments) (*ExternalFunction, error) {
externalFunctions, err := v.Show(ctx, NewShowExternalFunctionRequest().WithIn(In{Schema: id.SchemaId()}).WithLike(Like{String(id.Name())}))
request := NewShowExternalFunctionRequest().
WithIn(In{Schema: id.SchemaId()}).
WithLike(Like{Pattern: String(id.Name())})
externalFunctions, err := v.Show(ctx, request)
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/external_volumes_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,6 @@ var ExternalVolumesDef = g.NewInterface(
SQL("EXTERNAL VOLUMES").
OptionalLike(),
).
ShowByIdOperation()
ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
)
5 changes: 4 additions & 1 deletion pkg/sdk/functions_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,10 @@ var FunctionsDef = g.NewInterface(
SQL("USER FUNCTIONS").
OptionalLike().
OptionalExtendedIn(),
).ShowByIdOperation().DescribeOperation(
).ShowByIdOperationWithFiltering(
g.ShowByIDExtendedInFiltering,
g.ShowByIDLikeFiltering,
).DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-function",
g.DbStruct("functionDetailRow").
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/functions_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ func (v *functions) Show(ctx context.Context, request *ShowFunctionRequest) ([]F
}

func (v *functions) ShowByID(ctx context.Context, id SchemaObjectIdentifierWithArguments) (*Function, error) {
functions, err := v.Show(ctx, NewShowFunctionRequest().WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}).WithLike(Like{String(id.Name())}))
request := NewShowFunctionRequest().
WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}).
WithLike(Like{Pattern: String(id.Name())})
functions, err := v.Show(ctx, request)
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/managed_accounts_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ var ManagedAccountsDef = g.NewInterface(
SQL("MANAGED ACCOUNTS").
OptionalLike(),
).
ShowByIdOperation()
ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
)
4 changes: 2 additions & 2 deletions pkg/sdk/managed_accounts_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/sdk/managed_accounts_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func (v *managedAccounts) Show(ctx context.Context, request *ShowManagedAccountR
}

func (v *managedAccounts) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*ManagedAccount, error) {
managedAccounts, err := v.Show(ctx, NewShowManagedAccountRequest().WithLike(&Like{String(id.Name())}))
request := NewShowManagedAccountRequest().
WithLike(Like{Pattern: String(id.Name())})
managedAccounts, err := v.Show(ctx, request)
if err != nil {
return nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/sdk/materialized_views_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ var MaterializedViewsDef = g.NewInterface(
OptionalLike().
OptionalIn(),
).
ShowByIdOperation().
ShowByIdOperationWithFiltering(
g.ShowByIDInFiltering,
g.ShowByIDLikeFiltering,
).
DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-materialized-view",
Expand Down
8 changes: 4 additions & 4 deletions pkg/sdk/materialized_views_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/sdk/materialized_views_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ func (v *materializedViews) Show(ctx context.Context, request *ShowMaterializedV
}

func (v *materializedViews) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*MaterializedView, error) {
request := NewShowMaterializedViewRequest().WithIn(&In{Schema: id.SchemaId()}).WithLike(&Like{String(id.Name())})
request := NewShowMaterializedViewRequest().
WithIn(In{Schema: id.SchemaId()}).
WithLike(Like{Pattern: String(id.Name())})
materializedViews, err := v.Show(ctx, request)
if err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/network_policies_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ var (
SQL("NETWORK POLICIES").
OptionalLike(),
).
ShowByIdOperation().
ShowByIdOperationWithFiltering(
g.ShowByIDLikeFiltering,
).
DescribeOperation(
g.DescriptionMappingKindSlice,
"https://docs.snowflake.com/en/sql-reference/sql/desc-network-policy",
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/network_policies_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ func (v *networkPolicies) Show(ctx context.Context, request *ShowNetworkPolicyRe
}

func (v *networkPolicies) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*NetworkPolicy, error) {
networkPolicies, err := v.Show(ctx, NewShowNetworkPolicyRequest().WithLike(Like{Pattern: String(id.Name())}))
request := NewShowNetworkPolicyRequest().
WithLike(Like{Pattern: String(id.Name())})
networkPolicies, err := v.Show(ctx, request)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit e0ed15b

Please sign in to comment.