Skip to content

Commit

Permalink
New Resource: azurerm_new_relic_monitor (hashicorp#21958)
Browse files Browse the repository at this point in the history
Co-authored-by: kt <kt@katbyte.me>
  • Loading branch information
2 people authored and ziyeqf committed Jun 26, 2023
1 parent d150dbc commit 43f1096
Show file tree
Hide file tree
Showing 53 changed files with 3,197 additions and 1 deletion.
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var services = mapOf(
"mysql" to "MySQL",
"netapp" to "NetApp",
"network" to "Network",
"newrelic" to "New Relic",
"nginx" to "Nginx",
"notificationhub" to "Notification Hub",
"orbital" to "Orbital",
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/components/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ var serviceTestConfigurationOverrides = mapOf(
// netapp has a max of 10 accounts and the max capacity of pool is 25 TiB per subscription so lets limit it to 1 to account for broken ones, run Monday, Wednesday, Friday
"netapp" to testConfiguration(parallelism = 1, daysOfWeek = "2,4,6", locationOverride = LocationConfiguration("westeurope", "eastus2", "westus2", false), useDevTestSubscription = true),

// New Relic is only available in East US region
"newrelic" to testConfiguration(locationOverride = LocationConfiguration("eastus", "eastus", "eastus", false)),

// Orbital is only available in certain locations
"orbital" to testConfiguration(locationOverride = LocationConfiguration("eastus", "southcentralus", "westus2", false)),

Expand Down
5 changes: 5 additions & 0 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import (
mysql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/client"
netapp "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client"
network "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/client"
newrelic "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic/client"
nginx "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx/client"
notificationhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client"
orbital "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital/client"
Expand Down Expand Up @@ -224,6 +225,7 @@ type Client struct {
MySQL *mysql.Client
NetApp *netapp.Client
Network *network.Client
NewRelic *newrelic.Client
Nginx *nginx2.Client
NotificationHubs *notificationhub.Client
Orbital *orbital.Client
Expand Down Expand Up @@ -415,6 +417,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Network, err = network.NewClient(o); err != nil {
return fmt.Errorf("building clients for Network: %+v", err)
}
if client.NewRelic, err = newrelic.NewClient(o); err != nil {
return fmt.Errorf("building clients for NewRelic: %+v", err)
}
if client.Nginx, err = nginx.NewClient(o); err != nil {
return fmt.Errorf("building clients for Nginx: %+v", err)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital"
Expand Down Expand Up @@ -166,6 +167,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
mysql.Registration{},
network.Registration{},
netapp.Registration{},
newrelic.Registration{},
nginx.Registration{},
policy.Registration{},
privatednsresolver.Registration{},
Expand Down
23 changes: 23 additions & 0 deletions internal/services/newrelic/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package client

import (
"github.com/hashicorp/go-azure-sdk/resource-manager/newrelic/2022-07-01/monitors"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
MonitorsClient *monitors.MonitorsClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {

monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, err
}
o.Configure(monitorsClient.Client, o.Authorizers.ResourceManager)

return &Client{
MonitorsClient: monitorsClient,
}, nil
}
Loading

0 comments on commit 43f1096

Please sign in to comment.