Skip to content

Commit

Permalink
Reintroduce support for wams client addon
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught committed Jun 29, 2023
1 parent 3a46223 commit d6f23f6
Show file tree
Hide file tree
Showing 9 changed files with 479 additions and 236 deletions.
9 changes: 9 additions & 0 deletions docs/data-sources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Read-Only:
- `sharepoint` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sharepoint))
- `slack` (List of Object) (see [below for nested schema](#nestedobjatt--addons--slack))
- `springcm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--springcm))
- `wams` (List of Object) (see [below for nested schema](#nestedobjatt--addons--wams))

<a id="nestedobjatt--addons--aws"></a>
### Nested Schema for `addons.aws`
Expand Down Expand Up @@ -285,6 +286,14 @@ Read-Only:
- `acs_url` (String)


<a id="nestedobjatt--addons--wams"></a>
### Nested Schema for `addons.wams`

Read-Only:

- `master_key` (String)



<a id="nestedatt--jwt_configuration"></a>
### Nested Schema for `jwt_configuration`
Expand Down
9 changes: 9 additions & 0 deletions docs/data-sources/global_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Read-Only:
- `sharepoint` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sharepoint))
- `slack` (List of Object) (see [below for nested schema](#nestedobjatt--addons--slack))
- `springcm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--springcm))
- `wams` (List of Object) (see [below for nested schema](#nestedobjatt--addons--wams))

<a id="nestedobjatt--addons--aws"></a>
### Nested Schema for `addons.aws`
Expand Down Expand Up @@ -274,6 +275,14 @@ Read-Only:
- `acs_url` (String)


<a id="nestedobjatt--addons--wams"></a>
### Nested Schema for `addons.wams`

Read-Only:

- `master_key` (String)



<a id="nestedatt--jwt_configuration"></a>
### Nested Schema for `jwt_configuration`
Expand Down
9 changes: 9 additions & 0 deletions docs/resources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Optional:
- `sharepoint` (Block List, Max: 1) SharePoint SSO configuration. (see [below for nested schema](#nestedblock--addons--sharepoint))
- `slack` (Block List, Max: 1) Slack team or workspace name usually first segment in your Slack URL, for example `https://acme-org.slack.com` would be `acme-org`. (see [below for nested schema](#nestedblock--addons--slack))
- `springcm` (Block List, Max: 1) SpringCM SSO configuration. (see [below for nested schema](#nestedblock--addons--springcm))
- `wams` (Block List, Max: 1) Windows Azure Mobile Services addon configuration. (see [below for nested schema](#nestedblock--addons--wams))

<a id="nestedblock--addons--aws"></a>
### Nested Schema for `addons.aws`
Expand Down Expand Up @@ -350,6 +351,14 @@ Optional:
- `acs_url` (String) SpringCM ACS URL, for example `https://na11.springcm.com/atlas/sso/SSOEndpoint.ashx`.


<a id="nestedblock--addons--wams"></a>
### Nested Schema for `addons.wams`

Optional:

- `master_key` (String, Sensitive) Your master key for Windows Azure Mobile Services.



<a id="nestedblock--jwt_configuration"></a>
### Nested Schema for `jwt_configuration`
Expand Down
9 changes: 9 additions & 0 deletions docs/resources/global_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Optional:
- `sharepoint` (Block List, Max: 1) SharePoint SSO configuration. (see [below for nested schema](#nestedblock--addons--sharepoint))
- `slack` (Block List, Max: 1) Slack team or workspace name usually first segment in your Slack URL, for example `https://acme-org.slack.com` would be `acme-org`. (see [below for nested schema](#nestedblock--addons--slack))
- `springcm` (Block List, Max: 1) SpringCM SSO configuration. (see [below for nested schema](#nestedblock--addons--springcm))
- `wams` (Block List, Max: 1) Windows Azure Mobile Services addon configuration. (see [below for nested schema](#nestedblock--addons--wams))

<a id="nestedblock--addons--aws"></a>
### Nested Schema for `addons.aws`
Expand Down Expand Up @@ -293,6 +294,14 @@ Optional:
- `acs_url` (String) SpringCM ACS URL, for example `https://na11.springcm.com/atlas/sso/SSOEndpoint.ashx`.


<a id="nestedblock--addons--wams"></a>
### Nested Schema for `addons.wams`

Optional:

- `master_key` (String, Sensitive) Your master key for Windows Azure Mobile Services.



<a id="nestedblock--jwt_configuration"></a>
### Nested Schema for `jwt_configuration`
Expand Down
15 changes: 15 additions & 0 deletions internal/auth0/client/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ func expandClientAddons(d *schema.ResourceData) *management.ClientAddons {
addons.SAPAPI = expandClientAddonSAPAPI(addonsCfg.GetAttr("sap_api"))
addons.SharePoint = expandClientAddonSharepoint(addonsCfg.GetAttr("sharepoint"))
addons.SpringCM = expandClientAddonSpringCM(addonsCfg.GetAttr("springcm"))
addons.WAMS = expandClientAddonWAMS(addonsCfg.GetAttr("wams"))
return stop
})

Expand Down Expand Up @@ -595,6 +596,20 @@ func expandClientAddonSpringCM(springCMCfg cty.Value) *management.SpringCMClient
return &springCMAddon
}

func expandClientAddonWAMS(wamsCfg cty.Value) *management.WAMSClientAddon {
var wamsAddon management.WAMSClientAddon

wamsCfg.ForEachElement(func(_ cty.Value, wamsCfg cty.Value) (stop bool) {
wamsAddon = management.WAMSClientAddon{
Masterkey: value.String(wamsCfg.GetAttr("master_key")),
}

return stop
})

return &wamsAddon
}

func clientHasChange(c *management.Client) bool {
return c.String() != "{}"
}
9 changes: 9 additions & 0 deletions internal/auth0/client/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
"sap_api": nil,
"sharepoint": nil,
"springcm": nil,
"wams": nil,
}

if addons.GetAWS() != nil {
Expand Down Expand Up @@ -307,5 +308,13 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
}
}

if addons.GetWAMS() != nil {
m["wams"] = []interface{}{
map[string]interface{}{
"master_key": addons.GetWAMS().GetMasterkey(),
},
}
}

return []interface{}{m}
}
17 changes: 17 additions & 0 deletions internal/auth0/client/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,23 @@ func NewResource() *schema.Resource {
},
},
},
"wams": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Windows Azure Mobile Services addon configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"master_key": {
Description: "Your master key for Windows Azure Mobile Services.",
Type: schema.TypeString,
Optional: true,
Sensitive: true,
},
},
},
},
},
},
},
Expand Down
22 changes: 22 additions & 0 deletions internal/auth0/client/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,19 @@ resource "auth0_client" "my_client" {
}
`

const testAccUpdateClientWithAddonsWAMS = `
resource "auth0_client" "my_client" {
name = "Acceptance Test - SSO Integration - {{.testName}}"
app_type = "sso_integration"
addons {
wams {
master_key = "master-key"
}
}
}
`

func TestAccClientAddons(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -1206,6 +1219,15 @@ func TestAccClientAddons(t *testing.T) {
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.springcm.0.acs_url", "https://example.com"),
),
},
{
Config: acctest.ParseTestName(testAccUpdateClientWithAddonsWAMS, t.Name()),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - SSO Integration - %s", t.Name())),
resource.TestCheckResourceAttr("auth0_client.my_client", "app_type", "sso_integration"),
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.#", "1"),
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.wams.0.master_key", "master-key"),
),
},
},
})
}
Expand Down

0 comments on commit d6f23f6

Please sign in to comment.