Skip to content

Commit

Permalink
Formatted Code
Browse files Browse the repository at this point in the history
  • Loading branch information
theonlyames committed Aug 13, 2024
1 parent 2c73f8b commit d45958c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
)

type MsSqlManagedDatabaseDataSourceModel struct {
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
ManagedInstanceName string `tfschema:"managed_instance_name"`
ManagedInstanceId string `tfschema:"managed_instance_id"`
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
ManagedInstanceName string `tfschema:"managed_instance_name"`
ManagedInstanceId string `tfschema:"managed_instance_id"`
LongTermRetentionPolicy []LongTermRetentionPolicy `tfschema:"long_term_retention_policy"`
ShortTermRetentionDays int64 `tfschema:"short_term_retention_days"`
PointInTimeRestore []PointInTimeRestore `tfschema:"point_in_time_restore"`
Expand Down Expand Up @@ -68,8 +68,8 @@ func (d MsSqlManagedDatabaseDataSource) Arguments() map[string]*pluginsdk.Schema
func (d MsSqlManagedDatabaseDataSource) Attributes() map[string]*pluginsdk.Schema {
return map[string]*pluginsdk.Schema{
"managed_instance_id": {
Type: pluginsdk.TypeString,
Computed: true,
Type: pluginsdk.TypeString,
Computed: true,
},
"long_term_retention_policy": {
Type: pluginsdk.TypeList,
Expand All @@ -78,32 +78,32 @@ func (d MsSqlManagedDatabaseDataSource) Attributes() map[string]*pluginsdk.Schem
Schema: map[string]*pluginsdk.Schema{
// WeeklyRetention - The weekly retention policy for an LTR backup in an ISO 8601 format.
"weekly_retention": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
},

// MonthlyRetention - The monthly retention policy for an LTR backup in an ISO 8601 format.
"monthly_retention": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
},

// YearlyRetention - The yearly retention policy for an LTR backup in an ISO 8601 format.
"yearly_retention": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
},

// WeekOfYear - The week of year to take the yearly backup in an ISO 8601 format.
"week_of_year": {
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
},

"immutable_backups_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Expand Down Expand Up @@ -133,8 +133,6 @@ func (d MsSqlManagedDatabaseDataSource) Read() sdk.ResourceFunc {
longTermRetentionClient := metadata.Client.MSSQLManagedInstance.ManagedInstancesLongTermRetentionPoliciesClient
shortTermRetentionClient := metadata.Client.MSSQLManagedInstance.ManagedInstancesShortTermRetentionPoliciesClient



var state MsSqlManagedDatabaseDataSourceModel
if err := metadata.Decode(&state); err != nil {
return fmt.Errorf("decoding: %+v)", err)
Expand All @@ -151,7 +149,7 @@ func (d MsSqlManagedDatabaseDataSource) Read() sdk.ResourceFunc {
}

model := MsSqlManagedDatabaseDataSourceModel{
Name: id.DatabaseName,
Name: id.DatabaseName,
ManagedInstanceName: managedInstanceId.Name,
ResourceGroupName: id.ResourceGroup,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ import (
type MsSqlManagedDatabaseDataSource struct{}

func TestAccDataSourceMsSqlManagedDatabase_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_mssql_managed_database", "test")

data.DataSourceTest(t, []acceptance.TestStep{
{
Config: MsSqlManagedDatabaseDataSource{}.basic(data),
Check: acceptance.ComposeTestCheckFunc(
// check.That(data.ResourceName).Key("location").Exists(),
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("resource_group_name").Exists(),
// check.That(data.ResourceName).Key("tags.%").HasValue("2"),
check.That(data.ResourceName).Key("managed_instance_name").Exists(),
),
},
})
data := acceptance.BuildTestData(t, "data.azurerm_mssql_managed_database", "test")

data.DataSourceTest(t, []acceptance.TestStep{
{
Config: MsSqlManagedDatabaseDataSource{}.basic(data),
Check: acceptance.ComposeTestCheckFunc(
// check.That(data.ResourceName).Key("location").Exists(),
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("resource_group_name").Exists(),
// check.That(data.ResourceName).Key("tags.%").HasValue("2"),
check.That(data.ResourceName).Key("managed_instance_name").Exists(),
),
},
})
}

func (d MsSqlManagedDatabaseDataSource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
return fmt.Sprintf(`
%[1]s
data "azurerm_mssql_managed_database" "test" {
Expand Down

0 comments on commit d45958c

Please sign in to comment.