Skip to content

Commit

Permalink
support new resource for resource connector RP
Browse files Browse the repository at this point in the history
  • Loading branch information
sinbai committed Aug 29, 2023
1 parent fe7093c commit c1d98d6
Show file tree
Hide file tree
Showing 44 changed files with 2,272 additions and 0 deletions.
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ var services = mapOf(
"redisenterprise" to "Redis Enterprise",
"relay" to "Relay",
"resource" to "Resources",
"resourceconnector" to "Resource Connector",
"sql" to "SQL",
"search" to "Search",
"securitycenter" to "Security Center",
Expand Down
5 changes: 5 additions & 0 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ import (
redisenterprise "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/client"
relay "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/client"
resource "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client"
resourceConnector "github.com/hashicorp/terraform-provider-azurerm/internal/services/resourceconnector/client"
search "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/client"
securityCenter "github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/client"
sentinel "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/client"
Expand Down Expand Up @@ -254,6 +255,7 @@ type Client struct {
RedisEnterprise *redisenterprise.Client
Relay *relay.Client
Resource *resource.Client
ResourceConnector *resourceConnector.Client
Search *search.Client
SecurityCenter *securityCenter.Client
Sentinel *sentinel.Client
Expand Down Expand Up @@ -554,6 +556,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Resource, err = resource.NewClient(o); err != nil {
return fmt.Errorf("building clients for Resource: %+v", err)
}
if client.ResourceConnector, err = resourceConnector.NewClient(o); err != nil {
return fmt.Errorf("building clients for Resource connector: %+v", err)
}
if client.Search, err = search.NewClient(o); err != nil {
return fmt.Errorf("building clients for Search: %+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 @@ -107,6 +107,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/relay"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/resource"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/resourceconnector"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/search"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel"
Expand Down Expand Up @@ -186,6 +187,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
privatednsresolver.Registration{},
recoveryservices.Registration{},
resource.Registration{},
resourceconnector.Registration{},
sentinel.Registration{},
serviceconnector.Registration{},
servicefabricmanaged.Registration{},
Expand Down
24 changes: 24 additions & 0 deletions internal/services/resourceconnector/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/resourceconnector/2022-10-27/appliances"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
AppliancesClient *appliances.AppliancesClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {
appliancesClient, err := appliances.NewAppliancesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building appliances Client: %+v", err)
}
o.Configure(appliancesClient.Client, o.Authorizers.ResourceManager)

return &Client{
AppliancesClient: appliancesClient,
}, nil
}
33 changes: 33 additions & 0 deletions internal/services/resourceconnector/registration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package resourceconnector

import (
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
)

var _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{}

type Registration struct{}

func (r Registration) AssociatedGitHubLabel() string {
return "service/resource-connector"
}

func (r Registration) Name() string {
return "Resource Connector"
}

func (r Registration) DataSources() []sdk.DataSource {
return []sdk.DataSource{}
}

func (r Registration) Resources() []sdk.Resource {
return []sdk.Resource{
ResourceConnectorApplianceResource{},
}
}

func (r Registration) WebsiteCategories() []string {
return []string{
"Resource Connector",
}
}
Loading

0 comments on commit c1d98d6

Please sign in to comment.