Skip to content

Commit

Permalink
New Resource: azurerm_dynatrace_monitor (#27432)
Browse files Browse the repository at this point in the history
* New resources: azurerm_dynatrace_monitors, azurerm_dynatrace_tag_rules

* Adding documentation

* Add subcategory

* Renaming parameters

* change variable names

* Fix acc tests

* Renaming variables

* fix schema

* fix imports

* retrigger teamcity run

* rebase dynatrace

* Update API

* New Resource: azurerm_dynatrace_monitors

* sort imports

* Fix imports

* Fix lint

* Fix gencheck

* Fix gofmt

* Remove redundant condition

* Address PR comments

* Update docs

* Update expand/flatten identity helper

* Add prechecks

* remove effective date, testing

* modified tests, replace pointers

* modified docs

* upgrade vendor

* fix go gen

* skip tests

* inclined some functions, changed docs

* fix imports

* update vendors

* inlined values, add tracking issue

* Format code to follow guidance

* format acc test
  • Loading branch information
jiaweitao001 authored Nov 8, 2024
1 parent d749958 commit 4b761e8
Show file tree
Hide file tree
Showing 55 changed files with 3,514 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ service/dns:
service/domain-services:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_active_directory_domain_service((.|\n)*)###'

service/dynatrace:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_dynatrace_monitor((.|\n)*)###'

service/elastic:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_elastic_cloud_elasticsearch((.|\n)*)###'

Expand Down
5 changes: 5 additions & 0 deletions .github/labeler-pull-request-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ service/domain-services:
- any-glob-to-any-file:
- internal/services/domainservices/**/*

service/dynatrace:
- changed-files:
- any-glob-to-any-file:
- internal/services/dynatrace/**/*

service/elastic:
- changed-files:
- any-glob-to-any-file:
Expand Down
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var services = mapOf(
"devtestlabs" to "Dev Test",
"digitaltwins" to "Digital Twins",
"domainservices" to "DomainServices",
"dynatrace" to "Dynatrace",
"elastic" to "Elastic",
"elasticsan" to "ElasticSan",
"eventgrid" to "EventGrid",
Expand Down
5 changes: 5 additions & 0 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import (
digitaltwins "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/client"
dns "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client"
domainservices "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client"
dynatrace "github.com/hashicorp/terraform-provider-azurerm/internal/services/dynatrace/client"
elastic "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client"
elasticsan "github.com/hashicorp/terraform-provider-azurerm/internal/services/elasticsan/client"
eventgrid "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/client"
Expand Down Expand Up @@ -202,6 +203,7 @@ type Client struct {
DigitalTwins *digitaltwins.Client
Dns *dns_v2018_05_01.Client
DomainServices *domainservices.Client
Dynatrace *dynatrace.Client
Elastic *elastic.Client
ElasticSan *elasticsan.Client
EventGrid *eventgrid_v2022_06_15.Client
Expand Down Expand Up @@ -437,6 +439,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.EventGrid, err = eventgrid.NewClient(o); err != nil {
return fmt.Errorf("building clients for EventGrid: %+v", err)
}
if client.Dynatrace, err = dynatrace.NewClient(o); err != nil {
return fmt.Errorf("building clients for Dynatrace: %+v", err)
}
if client.Eventhub, err = eventhub.NewClient(o); err != nil {
return fmt.Errorf("building clients for Eventhub: %+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 @@ -49,6 +49,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/dns"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/dynatrace"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/elasticsan"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid"
Expand Down Expand Up @@ -168,6 +169,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
digitaltwins.Registration{},
domainservices.Registration{},
elasticsan.Registration{},
dynatrace.Registration{},
eventhub.Registration{},
extendedlocation.Registration{},
fluidrelay.Registration{},
Expand Down
24 changes: 24 additions & 0 deletions internal/services/dynatrace/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2023-04-27/monitors"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
*monitors.MonitorsClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {
monitorClient, err := monitors.NewMonitorsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Dynatrace Monitor client: %+v", err)
}
o.Configure(monitorClient.Client, o.Authorizers.ResourceManager)

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

0 comments on commit 4b761e8

Please sign in to comment.