Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-swinkler committed Jan 23, 2024
1 parent 9ce6907 commit d0e33d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
5 changes: 2 additions & 3 deletions pkg/sdk/applications_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ var applicationSet = g.NewQueryStruct("ApplicationSet").
var applicationUnset = g.NewQueryStruct("ApplicationUnset").
OptionalSQL("COMMENT").
OptionalSQL("SHARE_EVENTS_WITH_PROVIDER").
OptionalSQL("DEBUG_MODE").
WithValidation(g.ExactlyOneValueSet, "Comment", "ShareEventsWithProvider", "DebugMode")
OptionalSQL("DEBUG_MODE")

var applicationReferences = g.NewQueryStruct("ApplicationReferences").ListQueryStructField(
"References",
Expand Down Expand Up @@ -80,7 +79,7 @@ var ApplicationsDef = g.NewInterface(
OptionalQueryStructField(
"Unset",
applicationUnset,
g.KeywordOptions().SQL("UNSET"),
g.ListOptions().NoParentheses().SQL("UNSET"),
).
OptionalSQL("UPGRADE").
OptionalQueryStructField(
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/applications_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type AlterApplicationOptions struct {
IfExists *bool `ddl:"keyword" sql:"IF EXISTS"`
name AccountObjectIdentifier `ddl:"identifier"`
Set *ApplicationSet `ddl:"keyword" sql:"SET"`
Unset *ApplicationUnset `ddl:"keyword" sql:"UNSET"`
Unset *ApplicationUnset `ddl:"list,no_parentheses" sql:"UNSET"`
Upgrade *bool `ddl:"keyword" sql:"UPGRADE"`
UpgradeVersion *ApplicationVersion `ddl:"keyword" sql:"UPGRADE USING"`
UnsetReferences *ApplicationReferences `ddl:"keyword" sql:"UNSET REFERENCES"`
Expand Down
5 changes: 0 additions & 5 deletions pkg/sdk/applications_validations_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ func (opts *AlterApplicationOptions) validate() error {
if !exactlyOneValueSet(opts.Set, opts.Unset, opts.Upgrade, opts.UpgradeVersion, opts.UnsetReferences, opts.SetTags, opts.UnsetTags) {
errs = append(errs, errExactlyOneOf("AlterApplicationOptions", "Set", "Unset", "Upgrade", "UpgradeVersion", "UnsetReferences", "SetTags", "UnsetTags"))
}
if valueSet(opts.Unset) {
if !exactlyOneValueSet(opts.Unset.Comment, opts.Unset.ShareEventsWithProvider, opts.Unset.DebugMode) {
errs = append(errs, errExactlyOneOf("AlterApplicationOptions.Unset", "Comment", "ShareEventsWithProvider", "DebugMode"))
}
}
if valueSet(opts.UpgradeVersion) {
if !exactlyOneValueSet(opts.UpgradeVersion.VersionDirectory, opts.UpgradeVersion.VersionAndPatch) {
errs = append(errs, errExactlyOneOf("AlterApplicationOptions.UpgradeVersion", "VersionDirectory", "VersionAndPatch"))
Expand Down
8 changes: 2 additions & 6 deletions pkg/sdk/testint/applications_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,14 @@ func TestInt_Applications(t *testing.T) {
_, e := createApplicationHandle(t, applicationPackageName, version, patch, false, true, false)
id := sdk.NewAccountObjectIdentifier(e.Name)

// unset coment
unset := sdk.NewApplicationUnsetRequest().WithComment(sdk.Bool(true))
unset := sdk.NewApplicationUnsetRequest().WithComment(sdk.Bool(true)).WithDebugMode(sdk.Bool(true))
err := client.Applications.Alter(ctx, sdk.NewAlterApplicationRequest(id).WithUnset(unset))
require.NoError(t, err)

o, err := client.Applications.ShowByID(ctx, id)
require.NoError(t, err)
require.Empty(t, o.Comment)

// unset debug mode
unset = sdk.NewApplicationUnsetRequest().WithDebugMode(sdk.Bool(true))
err = client.Applications.Alter(ctx, sdk.NewAlterApplicationRequest(id).WithUnset(unset))
require.NoError(t, err)
details, err := client.Applications.Describe(ctx, id)
require.NoError(t, err)
pairs := make(map[string]string)
Expand Down

0 comments on commit d0e33d7

Please sign in to comment.