Skip to content

Commit

Permalink
Reintroduce support for egnyte client addon
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught committed Jun 28, 2023
1 parent d4577a0 commit 8389d00
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 110 deletions.
9 changes: 9 additions & 0 deletions docs/data-sources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Read-Only:
- `azure_blob` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_blob))
- `azure_sb` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_sb))
- `echosign` (List of Object) (see [below for nested schema](#nestedobjatt--addons--echosign))
- `egnyte` (List of Object) (see [below for nested schema](#nestedobjatt--addons--egnyte))
- `mscrm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--mscrm))
- `rms` (List of Object) (see [below for nested schema](#nestedobjatt--addons--rms))
- `sentry` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sentry))
Expand Down Expand Up @@ -132,6 +133,14 @@ Read-Only:
- `domain` (String)


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

Read-Only:

- `domain` (String)


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

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 @@ -66,6 +66,7 @@ Read-Only:
- `azure_blob` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_blob))
- `azure_sb` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_sb))
- `echosign` (List of Object) (see [below for nested schema](#nestedobjatt--addons--echosign))
- `egnyte` (List of Object) (see [below for nested schema](#nestedobjatt--addons--egnyte))
- `mscrm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--mscrm))
- `rms` (List of Object) (see [below for nested schema](#nestedobjatt--addons--rms))
- `sentry` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sentry))
Expand Down Expand Up @@ -121,6 +122,14 @@ Read-Only:
- `domain` (String)


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

Read-Only:

- `domain` (String)


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

Expand Down
9 changes: 9 additions & 0 deletions docs/resources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Optional:
- `azure_blob` (Block List, Max: 1) Azure Blob Storage Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_blob))
- `azure_sb` (Block List, Max: 1) Azure Storage Bus Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_sb))
- `echosign` (Block List, Max: 1) Adobe EchoSign SSO configuration. (see [below for nested schema](#nestedblock--addons--echosign))
- `egnyte` (Block List, Max: 1) Egnyte SSO configuration. (see [below for nested schema](#nestedblock--addons--egnyte))
- `mscrm` (Block List, Max: 1) Microsoft Dynamics CRM SSO configuration. (see [below for nested schema](#nestedblock--addons--mscrm))
- `rms` (Block List, Max: 1) Active Directory Rights Management Service SSO configuration. (see [below for nested schema](#nestedblock--addons--rms))
- `sentry` (Block List, Max: 1) Sentry SSO configuration. (see [below for nested schema](#nestedblock--addons--sentry))
Expand Down Expand Up @@ -194,6 +195,14 @@ Optional:
- `domain` (String) Your custom domain found in your EchoSign URL, for example `https://acme-org.echosign.com` would be `acme-org`.


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

Optional:

- `domain` (String) Your custom domain found in your Egnyte URL, for example `https://acme-org.echosign.com` would be `acme-org`.


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

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 @@ -82,6 +82,7 @@ Optional:
- `azure_blob` (Block List, Max: 1) Azure Blob Storage Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_blob))
- `azure_sb` (Block List, Max: 1) Azure Storage Bus Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_sb))
- `echosign` (Block List, Max: 1) Adobe EchoSign SSO configuration. (see [below for nested schema](#nestedblock--addons--echosign))
- `egnyte` (Block List, Max: 1) Egnyte SSO configuration. (see [below for nested schema](#nestedblock--addons--egnyte))
- `mscrm` (Block List, Max: 1) Microsoft Dynamics CRM SSO configuration. (see [below for nested schema](#nestedblock--addons--mscrm))
- `rms` (Block List, Max: 1) Active Directory Rights Management Service SSO configuration. (see [below for nested schema](#nestedblock--addons--rms))
- `sentry` (Block List, Max: 1) Sentry SSO configuration. (see [below for nested schema](#nestedblock--addons--sentry))
Expand Down Expand Up @@ -137,6 +138,14 @@ Optional:
- `domain` (String) Your custom domain found in your EchoSign URL, for example `https://acme-org.echosign.com` would be `acme-org`.


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

Optional:

- `domain` (String) Your custom domain found in your Egnyte URL, for example `https://acme-org.echosign.com` would be `acme-org`.


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

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 @@ -252,6 +252,7 @@ func expandClientAddons(d *schema.ResourceData) *management.ClientAddons {
addons.Slack = expandClientAddonSlack(addonsCfg.GetAttr("slack"))
addons.Sentry = expandClientAddonSentry(addonsCfg.GetAttr("sentry"))
addons.EchoSign = expandClientAddonEchoSign(addonsCfg.GetAttr("echosign"))
addons.Egnyte = expandClientAddonEgnyte(addonsCfg.GetAttr("egnyte"))
return stop
})

Expand Down Expand Up @@ -405,6 +406,20 @@ func expandClientAddonEchoSign(echoSignCfg cty.Value) *management.EchoSignClient
return &echoSignAddon
}

func expandClientAddonEgnyte(egnyteCfg cty.Value) *management.EgnyteClientAddon {
var egnyteAddon management.EgnyteClientAddon

egnyteCfg.ForEachElement(func(_ cty.Value, egnyteCfg cty.Value) (stop bool) {
egnyteAddon = management.EgnyteClientAddon{
Domain: value.String(egnyteCfg.GetAttr("domain")),
}

return stop
})

return &egnyteAddon
}

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 @@ -103,6 +103,7 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
"slack": nil,
"sentry": nil,
"echosign": nil,
"egnyte": nil,
}

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

if addons.GetEgnyte() != nil {
m["egnyte"] = []interface{}{
map[string]interface{}{
"domain": addons.GetEgnyte().GetDomain(),
},
}
}

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 @@ -742,6 +742,23 @@ func NewResource() *schema.Resource {
},
},
},
"egnyte": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Egnyte SSO configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"domain": {
Description: "Your custom domain found in your Egnyte URL, for example " +
"`https://acme-org.echosign.com` 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 @@ -861,6 +861,19 @@ resource "auth0_client" "my_client" {
}
`

const testAccUpdateClientWithAddonsEgnyte = `
resource "auth0_client" "my_client" {
name = "Acceptance Test - SSO Integration - {{.testName}}"
app_type = "sso_integration"
addons {
egnyte {
domain = "acmeorg"
}
}
}
`

func TestAccClientAddons(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -955,6 +968,15 @@ func TestAccClientAddons(t *testing.T) {
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.echosign.0.domain", "acmeorg"),
),
},
{
Config: acctest.ParseTestName(testAccUpdateClientWithAddonsEgnyte, 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.egnyte.0.domain", "acmeorg"),
),
},
},
})
}
Expand Down
Loading

0 comments on commit 8389d00

Please sign in to comment.