forked from infracost/infracost
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Event Notifications (#232)
* Add all resources as free * Add usage variables to root yml * Fix root usage yml formatting * Add event-notifications to Global Catalog & sort * Add event-notifications under resource_instance & sort lists, where applicable * Add event-notifications unit test usage * Fix unit test usage yml formatting * Add Terraform unit tests for Event Notifications Plans: Lite, Standard * Change some usage from int to float * Set DefaultValue property to 0 * Add no-usage Terraform unit test * Set test usage to the minimum to show in results * Updated golden file to include Event Notifications * Add all Cost Components * Remove destinations & subscriptions as free * Update EN golden file to only 1 cost component * Update EN golden file to only 1 cost component * Better output for lite EN instances * Add support for en_destination_android resource * Add support for android subscriptions * Add destination android info in comments * Update function name for clarity * Add support for push notifications in Chrome * Add support for destinations in Chrome * Update function name for clarity * Add support for destinations in Firefox * Add support for destinations in Huawei * Add support for destinations in iOS * Add support for destinations in Safari * Add support for subscriptions in Firefox * Add support for subscriptions in Huawei * Fix output text * Add support for subscriptions in iOS * Add support for subscriptions in Safaro * Add support for subscriptions in Slack * Fix bug in referencing struct * Add support for subscriptions in MS Teams * Add support for subscriptions in PagerDuty * Remove 'lite' as option; not listed in description * Account for free 1000 notifications in lite * Add support for subscriptions in webhooks * Add support for subscriptions in ServiceNow * Add support for subscriptions in Code Engine * Add support for subscriptions in COS * Add support for SMS subscriptions * Add more usage for SMS subcription * Fix typo in variable name * Add explicit mention of lite plans * Add support for IBM e-mail subscriptions * Remove unused comments * Add support for custom domain email subscriptions * Account for free 20 emails in lite * Sort * Add more EN free resources * Make note of one-time setup fee
- Loading branch information
1 parent
8ea1bf4
commit 53aa782
Showing
140 changed files
with
6,253 additions
and
359 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,46 @@ | ||
package ibm | ||
|
||
import ( | ||
"github.com/infracost/infracost/internal/resources/ibm" | ||
"github.com/infracost/infracost/internal/schema" | ||
) | ||
|
||
func getEnDestinationRegistryItem() *schema.RegistryItem { | ||
return &schema.RegistryItem{ | ||
Name: "ibm_en_destination_android", | ||
RFunc: newEnDestination, | ||
ReferenceAttributes: []string{"instance_guid"}, | ||
} | ||
} | ||
|
||
func newEnDestination(d *schema.ResourceData, u *schema.UsageData) *schema.Resource { | ||
|
||
region := d.Get("region").String() | ||
name := d.Get("name").String() | ||
is_pre_prod := d.Get("config.0.params.0.pre_prod").Bool() | ||
var plan string | ||
|
||
enReferenceAttributes := d.References("instance_guid") | ||
if len(enReferenceAttributes) > 0 { | ||
plan = enReferenceAttributes[0].Get("plan").String() | ||
} | ||
|
||
r := &ibm.EnDestination{ | ||
Address: d.Address, | ||
IsPreProd: is_pre_prod, | ||
Name: name, | ||
Plan: plan, | ||
Region: region, | ||
} | ||
r.PopulateUsage(u) | ||
|
||
configuration := make(map[string]any) | ||
configuration["name"] = name | ||
configuration["plan"] = plan | ||
configuration["pre-prod"] = is_pre_prod | ||
configuration["region"] = region | ||
|
||
SetCatalogMetadata(d, d.Type, configuration) | ||
|
||
return r.BuildResource() | ||
} |
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,46 @@ | ||
package ibm | ||
|
||
import ( | ||
"github.com/infracost/infracost/internal/resources/ibm" | ||
"github.com/infracost/infracost/internal/schema" | ||
) | ||
|
||
func getEnDestinationChromeRegistryItem() *schema.RegistryItem { | ||
return &schema.RegistryItem{ | ||
Name: "ibm_en_destination_chrome", | ||
RFunc: newEnDestinationChrome, | ||
ReferenceAttributes: []string{"instance_guid"}, | ||
} | ||
} | ||
|
||
func newEnDestinationChrome(d *schema.ResourceData, u *schema.UsageData) *schema.Resource { | ||
|
||
region := d.Get("region").String() | ||
name := d.Get("name").String() | ||
is_pre_prod := d.Get("config.0.params.0.pre_prod").Bool() | ||
|
||
var plan string | ||
enReferenceAttributes := d.References("instance_guid") | ||
if len(enReferenceAttributes) > 0 { | ||
plan = enReferenceAttributes[0].Get("plan").String() | ||
} | ||
|
||
r := &ibm.EnDestinationChrome{ | ||
Address: d.Address, | ||
IsPreProd: is_pre_prod, | ||
Name: name, | ||
Plan: plan, | ||
Region: region, | ||
} | ||
r.PopulateUsage(u) | ||
|
||
configuration := make(map[string]any) | ||
configuration["name"] = name | ||
configuration["plan"] = plan | ||
configuration["pre-prod"] = is_pre_prod | ||
configuration["region"] = region | ||
|
||
SetCatalogMetadata(d, d.Type, configuration) | ||
|
||
return r.BuildResource() | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/providers/terraform/ibm/en_destination_chrome_test.go
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,16 @@ | ||
package ibm_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/infracost/infracost/internal/providers/terraform/tftest" | ||
) | ||
|
||
func TestEnDestinationChrome(t *testing.T) { | ||
t.Parallel() | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
tftest.GoldenFileResourceTests(t, "en_destination_chrome_test") | ||
} |
46 changes: 46 additions & 0 deletions
46
internal/providers/terraform/ibm/en_destination_firefox.go
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,46 @@ | ||
package ibm | ||
|
||
import ( | ||
"github.com/infracost/infracost/internal/resources/ibm" | ||
"github.com/infracost/infracost/internal/schema" | ||
) | ||
|
||
func getEnDestinationFirefoxRegistryItem() *schema.RegistryItem { | ||
return &schema.RegistryItem{ | ||
Name: "ibm_en_destination_firefox", | ||
RFunc: newEnDestinationFirefox, | ||
ReferenceAttributes: []string{"instance_guid"}, | ||
} | ||
} | ||
|
||
func newEnDestinationFirefox(d *schema.ResourceData, u *schema.UsageData) *schema.Resource { | ||
|
||
region := d.Get("region").String() | ||
name := d.Get("name").String() | ||
is_pre_prod := d.Get("config.0.params.0.pre_prod").Bool() | ||
|
||
var plan string | ||
enReferenceAttributes := d.References("instance_guid") | ||
if len(enReferenceAttributes) > 0 { | ||
plan = enReferenceAttributes[0].Get("plan").String() | ||
} | ||
|
||
r := &ibm.EnDestinationFirefox{ | ||
Address: d.Address, | ||
IsPreProd: is_pre_prod, | ||
Name: name, | ||
Plan: plan, | ||
Region: region, | ||
} | ||
r.PopulateUsage(u) | ||
|
||
configuration := make(map[string]any) | ||
configuration["name"] = name | ||
configuration["plan"] = plan | ||
configuration["pre-prod"] = is_pre_prod | ||
configuration["region"] = region | ||
|
||
SetCatalogMetadata(d, d.Type, configuration) | ||
|
||
return r.BuildResource() | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/providers/terraform/ibm/en_destination_firefox_test.go
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,16 @@ | ||
package ibm_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/infracost/infracost/internal/providers/terraform/tftest" | ||
) | ||
|
||
func TestEnDestinationFirefox(t *testing.T) { | ||
t.Parallel() | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
tftest.GoldenFileResourceTests(t, "en_destination_firefox_test") | ||
} |
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,46 @@ | ||
package ibm | ||
|
||
import ( | ||
"github.com/infracost/infracost/internal/resources/ibm" | ||
"github.com/infracost/infracost/internal/schema" | ||
) | ||
|
||
func getEnDestinationHuaweiRegistryItem() *schema.RegistryItem { | ||
return &schema.RegistryItem{ | ||
Name: "ibm_en_destination_huawei", | ||
RFunc: newEnDestinationHuawei, | ||
ReferenceAttributes: []string{"instance_guid"}, | ||
} | ||
} | ||
|
||
func newEnDestinationHuawei(d *schema.ResourceData, u *schema.UsageData) *schema.Resource { | ||
|
||
region := d.Get("region").String() | ||
name := d.Get("name").String() | ||
is_pre_prod := d.Get("config.0.params.0.pre_prod").Bool() | ||
|
||
var plan string | ||
enReferenceAttributes := d.References("instance_guid") | ||
if len(enReferenceAttributes) > 0 { | ||
plan = enReferenceAttributes[0].Get("plan").String() | ||
} | ||
|
||
r := &ibm.EnDestinationHuawei{ | ||
Address: d.Address, | ||
IsPreProd: is_pre_prod, | ||
Name: name, | ||
Plan: plan, | ||
Region: region, | ||
} | ||
r.PopulateUsage(u) | ||
|
||
configuration := make(map[string]any) | ||
configuration["name"] = name | ||
configuration["plan"] = plan | ||
configuration["pre-prod"] = is_pre_prod | ||
configuration["region"] = region | ||
|
||
SetCatalogMetadata(d, d.Type, configuration) | ||
|
||
return r.BuildResource() | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/providers/terraform/ibm/en_destination_huawei_test.go
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,16 @@ | ||
package ibm_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/infracost/infracost/internal/providers/terraform/tftest" | ||
) | ||
|
||
func TestEnDestinationHuawei(t *testing.T) { | ||
t.Parallel() | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
tftest.GoldenFileResourceTests(t, "en_destination_huawei_test") | ||
} |
46 changes: 46 additions & 0 deletions
46
internal/providers/terraform/ibm/en_destination_iphoneos.go
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,46 @@ | ||
package ibm | ||
|
||
import ( | ||
"github.com/infracost/infracost/internal/resources/ibm" | ||
"github.com/infracost/infracost/internal/schema" | ||
) | ||
|
||
func getEnDestinationIphoneosRegistryItem() *schema.RegistryItem { | ||
return &schema.RegistryItem{ | ||
Name: "ibm_en_destination_ios", | ||
RFunc: newEnDestinationIphoneos, | ||
ReferenceAttributes: []string{"instance_guid"}, | ||
} | ||
} | ||
|
||
func newEnDestinationIphoneos(d *schema.ResourceData, u *schema.UsageData) *schema.Resource { | ||
|
||
region := d.Get("region").String() | ||
name := d.Get("name").String() | ||
is_pre_prod := d.Get("config.0.params.0.pre_prod").Bool() | ||
|
||
var plan string | ||
enReferenceAttributes := d.References("instance_guid") | ||
if len(enReferenceAttributes) > 0 { | ||
plan = enReferenceAttributes[0].Get("plan").String() | ||
} | ||
|
||
r := &ibm.EnDestinationIphoneos{ | ||
Address: d.Address, | ||
IsPreProd: is_pre_prod, | ||
Name: name, | ||
Plan: plan, | ||
Region: region, | ||
} | ||
r.PopulateUsage(u) | ||
|
||
configuration := make(map[string]any) | ||
configuration["name"] = name | ||
configuration["plan"] = plan | ||
configuration["pre-prod"] = is_pre_prod | ||
configuration["region"] = region | ||
|
||
SetCatalogMetadata(d, d.Type, configuration) | ||
|
||
return r.BuildResource() | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/providers/terraform/ibm/en_destination_iphoneos_test.go
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,16 @@ | ||
package ibm_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/infracost/infracost/internal/providers/terraform/tftest" | ||
) | ||
|
||
func TestEnDestinationIphoneos(t *testing.T) { | ||
t.Parallel() | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
tftest.GoldenFileResourceTests(t, "en_destination_iphoneos_test") | ||
} |
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,46 @@ | ||
package ibm | ||
|
||
import ( | ||
"github.com/infracost/infracost/internal/resources/ibm" | ||
"github.com/infracost/infracost/internal/schema" | ||
) | ||
|
||
func getEnDestinationSafariRegistryItem() *schema.RegistryItem { | ||
return &schema.RegistryItem{ | ||
Name: "ibm_en_destination_safari", | ||
RFunc: newEnDestinationSafari, | ||
ReferenceAttributes: []string{"instance_guid"}, | ||
} | ||
} | ||
|
||
func newEnDestinationSafari(d *schema.ResourceData, u *schema.UsageData) *schema.Resource { | ||
|
||
region := d.Get("region").String() | ||
name := d.Get("name").String() | ||
is_pre_prod := d.Get("config.0.params.0.pre_prod").Bool() | ||
|
||
var plan string | ||
enReferenceAttributes := d.References("instance_guid") | ||
if len(enReferenceAttributes) > 0 { | ||
plan = enReferenceAttributes[0].Get("plan").String() | ||
} | ||
|
||
r := &ibm.EnDestinationSafari{ | ||
Address: d.Address, | ||
IsPreProd: is_pre_prod, | ||
Name: name, | ||
Plan: plan, | ||
Region: region, | ||
} | ||
r.PopulateUsage(u) | ||
|
||
configuration := make(map[string]any) | ||
configuration["name"] = name | ||
configuration["plan"] = plan | ||
configuration["pre-prod"] = is_pre_prod | ||
configuration["region"] = region | ||
|
||
SetCatalogMetadata(d, d.Type, configuration) | ||
|
||
return r.BuildResource() | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/providers/terraform/ibm/en_destination_safari_test.go
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,16 @@ | ||
package ibm_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/infracost/infracost/internal/providers/terraform/tftest" | ||
) | ||
|
||
func TestEnDestinationSafari(t *testing.T) { | ||
t.Parallel() | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
tftest.GoldenFileResourceTests(t, "en_destination_safari_test") | ||
} |
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,16 @@ | ||
package ibm_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/infracost/infracost/internal/providers/terraform/tftest" | ||
) | ||
|
||
func TestEnDestination(t *testing.T) { | ||
t.Parallel() | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
tftest.GoldenFileResourceTests(t, "en_destination_test") | ||
} |
Oops, something went wrong.