Skip to content

Commit

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

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


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

Read-Only:

- `account` (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 @@ -83,6 +83,7 @@ Read-Only:
- `springcm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--springcm))
- `wams` (List of Object) (see [below for nested schema](#nestedobjatt--addons--wams))
- `zendesk` (List of Object) (see [below for nested schema](#nestedobjatt--addons--zendesk))
- `zoom` (List of Object) (see [below for nested schema](#nestedobjatt--addons--zoom))

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


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

Read-Only:

- `account` (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 @@ -156,6 +156,7 @@ Optional:
- `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))
- `zendesk` (Block List, Max: 1) Zendesk SSO configuration. (see [below for nested schema](#nestedblock--addons--zendesk))
- `zoom` (Block List, Max: 1) Zoom SSO configuration. (see [below for nested schema](#nestedblock--addons--zoom))

<a id="nestedblock--addons--aws"></a>
### Nested Schema for `addons.aws`
Expand Down Expand Up @@ -368,6 +369,14 @@ Optional:
- `account_name` (String) Zendesk account name usually first segment in your Zendesk URL, for example `https://acme-org.zendesk.com` would be `acme-org`.


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

Optional:

- `account` (String) Zoom account name usually first segment of your Zoom URL, for example `https://acme-org.zoom.us` would be `acme-org`.



<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 @@ -99,6 +99,7 @@ Optional:
- `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))
- `zendesk` (Block List, Max: 1) Zendesk SSO configuration. (see [below for nested schema](#nestedblock--addons--zendesk))
- `zoom` (Block List, Max: 1) Zoom SSO configuration. (see [below for nested schema](#nestedblock--addons--zoom))

<a id="nestedblock--addons--aws"></a>
### Nested Schema for `addons.aws`
Expand Down Expand Up @@ -311,6 +312,14 @@ Optional:
- `account_name` (String) Zendesk account name usually first segment in your Zendesk URL, for example `https://acme-org.zendesk.com` would be `acme-org`.


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

Optional:

- `account` (String) Zoom account name usually first segment of your Zoom URL, for example `https://acme-org.zoom.us` would be `acme-org`.



<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 @@ -265,6 +265,7 @@ func expandClientAddons(d *schema.ResourceData) *management.ClientAddons {
addons.SpringCM = expandClientAddonSpringCM(addonsCfg.GetAttr("springcm"))
addons.WAMS = expandClientAddonWAMS(addonsCfg.GetAttr("wams"))
addons.Zendesk = expandClientAddonZendesk(addonsCfg.GetAttr("zendesk"))
addons.Zoom = expandClientAddonZoom(addonsCfg.GetAttr("zoom"))
return stop
})

Expand Down Expand Up @@ -625,6 +626,20 @@ func expandClientAddonZendesk(zendeskCfg cty.Value) *management.ZendeskClientAdd
return &zendeskAddon
}

func expandClientAddonZoom(zoomCfg cty.Value) *management.ZoomClientAddon {
var zoomAddon management.ZoomClientAddon

zoomCfg.ForEachElement(func(_ cty.Value, zoomCfg cty.Value) (stop bool) {
zoomAddon = management.ZoomClientAddon{
Account: value.String(zoomCfg.GetAttr("account")),
}

return stop
})

return &zoomAddon
}

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 @@ -115,6 +115,7 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
"springcm": nil,
"wams": nil,
"zendesk": nil,
"zoom": nil,
}

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

if addons.GetZoom() != nil {
m["zoom"] = []interface{}{
map[string]interface{}{
"account": addons.GetZoom().GetAccount(),
},
}
}

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 @@ -1085,6 +1085,23 @@ func NewResource() *schema.Resource {
},
},
},
"zoom": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Zoom SSO configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"account": {
Description: "Zoom account name usually first segment of your Zoom URL, for " +
"example `https://acme-org.zoom.us` would be `acme-org`.",
Type: schema.TypeString,
Optional: 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 @@ -1033,6 +1033,19 @@ resource "auth0_client" "my_client" {
}
`

const testAccUpdateClientWithAddonsZoom = `
resource "auth0_client" "my_client" {
name = "Acceptance Test - SSO Integration - {{.testName}}"
app_type = "sso_integration"
addons {
zoom {
account = "acmeorg"
}
}
}
`

func TestAccClientAddons(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -1250,6 +1263,15 @@ func TestAccClientAddons(t *testing.T) {
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.zendesk.0.account_name", "acmeorg"),
),
},
{
Config: acctest.ParseTestName(testAccUpdateClientWithAddonsZoom, 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.zoom.0.account", "acmeorg"),
),
},
},
})
}
Expand Down
Loading

0 comments on commit b89d0e5

Please sign in to comment.