Skip to content

Commit

Permalink
New resources: azurerm_active_directory_domain_service and azurerm_ac…
Browse files Browse the repository at this point in the history
…tive_directory_domain_service_replica_set
  • Loading branch information
manicminer committed Apr 29, 2021
1 parent f55190b commit 2c08c80
Show file tree
Hide file tree
Showing 32 changed files with 5,773 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 @@ -2,6 +2,7 @@
// to re-generate this file, run 'make generate' in the root of the repository
var services = mapOf(
"apimanagement" to "API Management",
"domainservices" to "AadMgmt",
"advisor" to "Advisor",
"analysisservices" to "Analysis Services",
"appconfiguration" to "App Configuration",
Expand Down
19 changes: 19 additions & 0 deletions azurerm/helpers/validate/strings.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
package validate

import (
"encoding/base64"
"fmt"
"strings"
)

// Base64EncodedString validates that the string is base64 encoded
func Base64EncodedString(i interface{}, k string) ([]string, []error) {
v, ok := i.(string)
if !ok {
return nil, []error{fmt.Errorf("expected type of %q to be string", k)}
}

if strings.TrimSpace(v) == "" {
return nil, []error{fmt.Errorf("%q must not be empty", k)}
}

if _, err := base64.StdEncoding.DecodeString(v); err != nil {
return nil, []error{fmt.Errorf("%q must be a valid base64 encoded string", k)}
}

return nil, nil
}

// LowerCasedString validates that the string is lower-cased
func LowerCasedString(i interface{}, k string) ([]string, []error) {
v, ok := i.(string)
Expand Down
28 changes: 28 additions & 0 deletions azurerm/helpers/validate/strings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ import (
"testing"
)

func TestBase64EncodedString(t *testing.T) {
cases := []struct {
Input string
Errors int
}{
{
Input: "",
Errors: 1,
},
{
Input: "aGVsbG8td29ybGQ=",
Errors: 0,
},
{
Input: "hello-world",
Errors: 1,
},
}

for _, tc := range cases {
t.Run(tc.Input, func(t *testing.T) {
if _, errors := Base64EncodedString(tc.Input, "base64"); len(errors) != tc.Errors {
t.Fatalf("Expected Base64 string to have %d not %d errors for %q: %v", tc.Errors, len(errors), tc.Input, errors)
}
})
}
}

func TestLowerCasedStrings(t *testing.T) {
cases := []struct {
Value string
Expand Down
3 changes: 3 additions & 0 deletions azurerm/internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
devtestlabs "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/devtestlabs/client"
digitaltwins "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/digitaltwins/client"
dns "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/dns/client"
domainservices "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/domainservices/client"
eventgrid "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventgrid/client"
eventhub "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventhub/client"
firewall "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/firewall/client"
Expand Down Expand Up @@ -138,6 +139,7 @@ type Client struct {
DevTestLabs *devtestlabs.Client
DigitalTwins *digitaltwins.Client
Dns *dns.Client
DomainServices *domainservices.Client
EventGrid *eventgrid.Client
Eventhub *eventhub.Client
Firewall *firewall.Client
Expand Down Expand Up @@ -240,6 +242,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.DevTestLabs = devtestlabs.NewClient(o)
client.DigitalTwins = digitaltwins.NewClient(o)
client.Dns = dns.NewClient(o)
client.DomainServices = domainservices.NewClient(o)
client.EventGrid = eventgrid.NewClient(o)
client.Eventhub = eventhub.NewClient(o)
client.Firewall = firewall.NewClient(o)
Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/devtestlabs"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/digitaltwins"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/dns"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/domainservices"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventgrid"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventhub"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/firewall"
Expand Down Expand Up @@ -140,6 +141,7 @@ func SupportedUntypedServices() []sdk.UntypedServiceRegistration {
devtestlabs.Registration{},
digitaltwins.Registration{},
dns.Registration{},
domainservices.Registration{},
eventgrid.Registration{},
eventhub.Registration{},
firewall.Registration{},
Expand Down
Loading

0 comments on commit 2c08c80

Please sign in to comment.