Skip to content

Commit

Permalink
New resource: azurerm_api_management_backend (#3676)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbuckle authored and katbyte committed Jul 6, 2019
1 parent b2c3bd6 commit 114ecfd
Show file tree
Hide file tree
Showing 7 changed files with 1,244 additions and 0 deletions.
11 changes: 11 additions & 0 deletions azurerm/helpers/validate/api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,14 @@ func ApiManagementApiPath(v interface{}, k string) (ws []string, es []error) {
}
return ws, es
}

func ApiManagementBackendName(v interface{}, k string) (warnings []string, errors []error) {
value := v.(string)

// From https://docs.microsoft.com/en-us/rest/api/apimanagement/2018-01-01/backend/createorupdate#uri-parameters
if matched := regexp.MustCompile(`(^[\w]+$)|(^[\w][\w\-]+[\w]$)`).Match([]byte(value)); !matched {
errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters and dashes up to 50 characters in length", k))
}

return warnings, errors
}
4 changes: 4 additions & 0 deletions azurerm/internal/services/apimanagement/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Client struct {
ApiSchemasClient apimanagement.APISchemaClient
ApiVersionSetClient apimanagement.APIVersionSetClient
AuthorizationServersClient apimanagement.AuthorizationServerClient
BackendClient apimanagement.BackendClient
CertificatesClient apimanagement.CertificateClient
GroupClient apimanagement.GroupClient
GroupUsersClient apimanagement.GroupUserClient
Expand Down Expand Up @@ -55,6 +56,9 @@ func BuildClient(o *common.ClientOptions) *Client {
c.AuthorizationServersClient = apimanagement.NewAuthorizationServerClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&c.AuthorizationServersClient.Client, o.ResourceManagerAuthorizer)

c.BackendClient = apimanagement.NewBackendClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&c.BackendClient.Client, o.ResourceManagerAuthorizer)

c.CertificatesClient = apimanagement.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&c.CertificatesClient.Client, o.ResourceManagerAuthorizer)

Expand Down
1 change: 1 addition & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_api_management_api_schema": resourceArmApiManagementApiSchema(),
"azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(),
"azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(),
"azurerm_api_management_backend": resourceArmApiManagementBackend(),
"azurerm_api_management_certificate": resourceArmApiManagementCertificate(),
"azurerm_api_management_group": resourceArmApiManagementGroup(),
"azurerm_api_management_group_user": resourceArmApiManagementGroupUser(),
Expand Down
Loading

0 comments on commit 114ecfd

Please sign in to comment.