Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT REVIEW!!! New service: DeviceRegistry #28399

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var services = mapOf(
"desktopvirtualization" to "Desktop Virtualization",
"devcenter" to "Dev Center",
"devtestlabs" to "Dev Test",
"deviceregistry" to "Device Registry",
"digitaltwins" to "Digital Twins",
"domainservices" to "DomainServices",
"dynatrace" to "Dynatrace",
Expand Down
3 changes: 3 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* @hashicorp/terraform-azure

# PRLabel: %Device Registrys
/internal/services/deviceregistry/ @marcodalessandro @rohankhandelwal @riteshrao
5 changes: 5 additions & 0 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import (
dataprotection "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client"
datashare "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/client"
desktopvirtualization "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client"
deviceregistry "github.com/hashicorp/terraform-provider-azurerm/internal/services/deviceregistry/client"
devtestlabs "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/client"
digitaltwins "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/client"
dns "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client"
Expand Down Expand Up @@ -199,6 +200,7 @@ type Client struct {
DataProtection *dataprotection.Client
DataShare *datashare.Client
DesktopVirtualization *desktopvirtualization.Client
DeviceRegistry *deviceregistry.Client
DevTestLabs *devtestlabs.Client
DigitalTwins *digitaltwins.Client
Dns *dns_v2018_05_01.Client
Expand Down Expand Up @@ -421,6 +423,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.DesktopVirtualization, err = desktopvirtualization.NewClient(o); err != nil {
return fmt.Errorf("building clients for DesktopVirtualization: %+v", err)
}
if client.DeviceRegistry, err = deviceregistry.NewClient(o); err != nil {
return fmt.Errorf("building clients for DeviceRegistry: %+v", err)
}
if client.DevTestLabs, err = devtestlabs.NewClient(o); err != nil {
return fmt.Errorf("building clients for DevTestLabs: %+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 @@ -45,6 +45,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/deviceregistry"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/dns"
Expand Down Expand Up @@ -167,6 +168,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
datafactory.Registration{},
dataprotection.Registration{},
desktopvirtualization.Registration{},
deviceregistry.Registration{},
digitaltwins.Registration{},
dns.Registration{},
domainservices.Registration{},
Expand Down
34 changes: 34 additions & 0 deletions internal/services/deviceregistry/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/deviceregistry/2024-11-01/assetendpointprofiles"
"github.com/hashicorp/go-azure-sdk/resource-manager/deviceregistry/2024-11-01/assets"

"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
AssetClient *assets.AssetsClient
AssetEndpointProfileClient *assetendpointprofiles.AssetEndpointProfilesClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {
assetEndpointProfileClient, err := assetendpointprofiles.NewAssetEndpointProfilesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("creating AssetEndpointProfiles Client: %+v", err)
}
o.Configure(assetEndpointProfileClient.Client, o.Authorizers.ResourceManager)

assetClient, err := assets.NewAssetsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("creating Asset Client: %+v", err)
}
o.Configure(assetClient.Client, o.Authorizers.ResourceManager)

return &Client{
AssetClient: assetClient,
AssetEndpointProfileClient: assetEndpointProfileClient,
}, nil
}
Loading