-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
052ed96
commit 4af4852
Showing
6 changed files
with
63 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package schema | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/mongodb/terraform-provider-mongodbatlas/tools/codegen/codespec" | ||
) | ||
|
||
type timeoutAttributeGenerator struct { | ||
timeouts codespec.TimeoutsAttribute | ||
} | ||
|
||
func (s *timeoutAttributeGenerator) AttributeCode() CodeStatement { | ||
var optionProperties string | ||
for op := range s.timeouts.ConfigurableTimeouts { | ||
switch op { | ||
case int(codespec.Create): | ||
optionProperties += "Create: true,\n" | ||
case int(codespec.Update): | ||
optionProperties += "Update: true,\n" | ||
case int(codespec.Delete): | ||
optionProperties += "Delete: true,\n" | ||
case int(codespec.Read): | ||
optionProperties += "Read: true,\n" | ||
} | ||
} | ||
return CodeStatement{ | ||
Code: fmt.Sprintf(`"timeouts": timeouts.Attributes(ctx, timeouts.Opts{ | ||
%s | ||
})`, optionProperties), | ||
Imports: []string{"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters